I have been having an issue compiling the following line of code on IntelliJ using Maven:
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
PacketPlayOutPlayerInfo.PlayerInfoData data = packet.new PlayerInfoData(gameprofile, 1, EnumGamemode.NOT_SET, CraftChatMessage.fromString(ChatColor.DARK_GRAY + "[NPC] " + this.gameprofile.getId().toString().substring(0, 8))[0]);
I get this error when compiling:
cannot access net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo.PlayerInfoData
[ERROR] bad class file: C:\Users\nokoa\.m2\repository\org\spigot\spigot\1.11.2\spigot-1.11.2.jar(net/minecraft/server/v1_11_R1/PacketPlayOutPlayerInfo$PlayerInfoData.class)
[ERROR] bad RuntimeInvisibleParameterAnnotations attribute: PlayerInfoData(com.mojang.authlib.GameProfile,int,net.minecraft.server.v1_11_R1.EnumGamemode,net.minecraft.server.v1_11_R1.IChatBaseComponent)
I tried using Spigot and Paper, also tried changing the compiler from javac to eclipse, but there is no change. I have been stuck with this for over five months, if anyone can please help me.
Related
I'm compiling a Minecraft mod with gradlew which I coded using Eclipse. The Minecraft mod uses an API which I have created previously. The problem is that when I'm trying to compile the mod with gradlew it gives me the error: "cannot find symbol".
The curious thing is now that when I'm moving the called function to a fresh class it does not give me the compilation error and everything is fine (I did not rename the function or changed anything in it I just moved it to a class where no other functions are in). Why is that? I would like to keep the function in the main class and not move it to a own class.
This is the method I'm using which gives me the error below:
public static void RegisterSlabBlock(Block slabBlock, Block doubleSlabBlock, Class ItemBlockSlab, String completeName, String slabBlockName, String doubleSlabBlockName, String ModID) {
try {
GameRegistry.registerBlock(slabBlock, ItemBlockSlab, slabBlockName, slabBlock, doubleSlabBlock, false);
GameRegistry.registerBlock(doubleSlabBlock, ItemBlockSlab,doubleSlabBlockName,slabBlock,doubleSlabBlock, true);
SetLSCount.increaseBlockCount(1);
DebugHelper.sendDebugInformation(slabBlock.toString(), 2, ModID, 5);
} catch (Exception e) {
ErrorHelper.AddError("Failed to register block: " + completeName + "; Exception: " + e);
}
}
The error in gradlew:
D:\Userdata\Louis\Dokumente\Programmieren\Forge Modding\1.8.9\Workspace - Trekcraft\build\sources\main\java\com\wix\lmh01\trekcraft\util\RegisterContent.java:34: error: cannot find symbol
RegisterHelper.RegisterBlockSlab(VariablesManager.block_warp_core_half_slab, VariablesManager.block_warp_core_double_slab, ItemBlockWarpCoreSlab.class, "block_warp_core_slab", "block_warp_core_half_slab", "block_warp_core_double_slab", Refrences.MODID);
^
symbol: method RegisterBlockSlab(Block,Block,Class<ItemBlockWarpCoreSlab>,String,String,String,String)
location: class RegisterHelper
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
1 warning
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
The ^ points to the dot after RegisterHelper.
The line I call this function with:
RegisterHelper.RegisterSlabBlock(VariablesManager.block_warp_core_half_slab, VariablesManager.block_warp_core_double_slab, ItemBlockWarpCoreSlab.class, "block_warp_core_slab", "block_warp_core_half_slab", "block_warp_core_double_slab", Refrences.MODID);
The line I call the function with from the other class
RegisterHelperBlocks.RegisterSlabBlock(VariablesManager.block_warp_core_half_slab, VariablesManager.block_warp_core_double_slab, ItemBlockWarpCoreSlab.class, "block_warp_core_slab", "block_warp_core_half_slab", "block_warp_core_double_slab", Refrences.MODID);
So it seams like something is wrong with the way I call the function with. It should normally work in booth ways I think.
I think everybody who has to work with Maven and Java8 knows of this bug that release builds suddenly fail for spelling mistakes in JavaDoc. As a company we decided to let some poor sap (aka me) work all of them out. Now I'm stuck with the following "error":
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.1:javadoc (default-cli) on project org.acme.project.demo: An error has occurred in JavaDocs report generation:
[ERROR] Exit code: 1 - C:\jenkins\workspace\Project 2.0\org.acme.project.demo\src\main\java\org\acme\project\demo\SomeClass.java:36: error: cannot access OtherClass
[ERROR] import org.acme.project.OtherClass;
[ERROR] ^
[ERROR] bad class file: C:\jenkins\workspace\Project 2.0\org.acme.project\target\org.acme.project-2.0.0-SNAPSHOT-v20150128-1503.jar(org/acme/project/OtherClass.class)
[ERROR] undeclared type variable: N
[ERROR] Please remove or make sure it appears in the correct subdirectory of the classpath.
I tried to clean it up a bit, but to summarize: Project B throws the exception when it tries to resolve a method call to Project A (yes, while generating JavaDoc!). The method in question looks like that:
public static <N extends Bean> void hookContinousImageFunction(final OtherClass<N> dialog,
final ImageGroup imageGroup, N model, final BiFunction<Image, N, ? extends Image> imageFunction) {
final Image original = imageGroup.getImage();
dialog.setOnCancelClick((notUsed) -> imageGroup.setImage(original));
model.addPropertyChangeListener(new ContinousImageFunctionListener<>(dialog, imageGroup, imageFunction));
dialog.setInitialModel(model);
}
It doesn't even have JavaDoc (not that any of this should matter when the generation of Project A's JavaDoc is already finished, and Maven is trying to generate JavaDoc for Project B).
As of now, we have this bug in multiple projects, about 1 out of 5. Project A (the one with a typed method / class like above) is more often than not in an entirely different build reactor and sometimes completely out of our control.
How do I fix this bug inside a bug?
(As a as a side note, the error occurs on the Jenkin's running with Java 1.8.0_31 and jdk1.8.0_40 or locally with 1.8.0_45, 1.8.0_60, but not locally with 1.8.0_20, but JavaDoc generation hasn't been that reliable, so I can't say for sure it has something to do with the Java version.)
I got the same kind of error message using a central build while having no problems in my local build. (Unfortunately I have no details about the central build environment.)
Adding a '#param ' explanation in the JavaDoc comment for the static method in question solved the issue. Adapted to the given example I did something like this:
/**
* #param <N> This is the class that ...
*/
public static <N extends Bean> void hookContinuousImageFunction(...)
Okay the answer is to a) downgrade Java to 1.8.0_20, or - if that is not possible - b) to use this code in the pom.xml to disable JavaDoc of the project until the Java people feel the need to fix the bug:
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
On Arch Linux, after upgrading to Gnome 3.14, I have several troubles with Webkit2Gtk.
Vala:
Consider the following vala test:
using Gtk;
using WebKit;
public class ValaWebkit : Window {
private WebView web_view;
public ValaWebkit(){
this.title = "Testing youtube";
set_default_size (800, 600);
web_view = new WebView();
add(web_view);
//this.web_view.open ("http://www.youtube.com/");
this.web_view.load_uri ("https://www.youtube.com/");
}
public static int main (string[] args) {
Gtk.init (ref args);
new ValaWebkit().show_all();
Gtk.main();
return 0;
}
}
Before upgrading to Gnome 3.14, I could copile like this valac --pkg gtk+-3.0 --pkg webkit2gtk-3.0 --vapidir . valawebkit.vala (I'm not pasting here webkit2gtk-3.0.vapi because it's too long). Now with gnome 3.14 if I try to compile i get
/home/luca/Sources/vala/webkit test/valawebkit.vala.c:8:29: fatal error: webkit2/webkit2.h: No such file or directory
#include <webkit2/webkit2.h>
^
compilation terminated.
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)
Also, If I try to run the binary that I had compiled BEFORE upgrading to Gnome 3.14, I get this error:
./valawebkit: error while loading shared libraries: libwebkit2gtk-3.0.so.25: cannot open shared object file: No such file or directory
2) GJS / Eclipse / Java (SWT):
If I run either this gjs example, or eclipse (luna) or any other swt 4.4 based app, I get the following:
No bp log location saved, using default.
[000:000] Cpu: 6.58.9, x4, 2600Mhz, 7847MB
[000:000] Computer model: Not available
[000:000] Browser XEmbed support present: 1
[000:000] Browser toolkit is Gtk2.
[000:004] Using Gtk2 toolkit
[000:004] Warning(optionsfile.cc:47): Load: Could not open file, err=2
[000:004] No bp log location saved, using default.
I have the feeling that it is a kind of packaging issue on ArchLinux and Gnome 3.14. Does anyone is having the same issue? Is there a workaround both to compile and run against webkit2gtk?
EDIT
I made a little progress: I discovered that headers files I need are now under /usr/include/webkitgtk3.0 and /usr/include/libsoup-2.4. Now, compiling like this:
valac --pkg gtk+-3.0 --pkg webkit2gtk-3.0 --vapidir . --Xcc="-I/usr/include/webkitgtk-3.0" --Xcc "-I/usr/include/libsoup-2.4" --thread valawebkit.vala
works, but it sill fails on linker:
/tmp/ccQGhB3b.o: In function `vala_webkit_construct':
valawebkit.vala.c:(.text+0x6e): undefined reference to `webkit_web_view_new'
valawebkit.vala.c:(.text+0x101): undefined reference to `webkit_web_view_load_uri'
collect2: error: ld returned 1 exit status
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)
There fact that you have to specify the --Xcc flags suggests that you are missing the pkgconfig file for WebKit. There should be a webkit2gtk-3.0.pc in /usr/lib/pkgconfig. The Arch package webkit2gtk has a pkgconfig file named webkit2gtk-4.0.pc. So, if you rename your VAPI file, that should link properly.
Actually with webkit2gtk-4.0 I don't need to provide a vapi file any more. So I can delete my webkit2gtk-4.0.vapi and complile like this (even simpler):
valac --pkg gtk+-3.0 --pkg webkit2gtk-4.0 --thread valawebkit.vala
Following is code which i am running :
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
public class Main_Extraction
{
public static void main( String[] args )
{
System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
Mat mat = Mat.eye( 3, 3, CvType.CV_8UC1 );
System.out.println( "mat = " + mat.dump() );
}
}
this code is having no compile time error.
but, it's giving me run-time exception which is :
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: <any>
at Main_Extraction.main(Main_Extraction.java:9) Java Result: 1
please, suggest the solution to remove this exception.
I had the same problem. Here is the solution, add this paths in your environment variable CLASSPATH. this will work.
C:\javacv\javacv.jar;
C:\javacv\javacpp.jar;
C:\javacv\javacv-windows-x86.jar;
C:\javacv\jna.jar;C:\javacv;
c:\opencv2.4\build\x86\vc10\bin;
set this according to your javacv installed folder.
You have attempted run a program that has compilation error in it. Fix the compilation errors BEFORE you try to run your program!!
this code is having no compile time error.
That is not true. The actual "compiled" bytecode file you are attempting to run is throwing an exception that says clearly that there was a compilation error of some kind.
Perhaps you are trying to compile a stale version ...
Perhaps you are compiling against a corrupted copy of the OpenCV JAR.
Perhaps you are using a buggy compiler ... and it crashed, giving you a bogus ".class" file.
Please check if the PATH variable is set correctly and opencv libraries are included, there is nothing wrong in the code.
Please follow this tutorial here for step by step installation of opencv in eclipse
http://nenadbulatovic.blogspot.de/2013/07/configuring-opencv-245-eclipse-cdt-juno.html
In my java program I make heavy use of Suns implmentation of the Rhino script engine. Very recently however, my JDK does not seem to automatically import the rt.jar file anymore when compiling.
Whats strange is that NetBeans reports 0 live errors, they only show up when doing a complete Clean & Build. This wasn't happening before when I was importing NativeArray, so I'm really confused on why it all of a sudden stopped working.
Specs:
OS - Windows
Java version - java version "1.6.0_20"
Javac version - javac 1.6.0_20
NetBeans version - 6.9
Check to see if it exists:
C:\Documents and Settings\LordQuackstar\Desktop\TestApp\src>javap sun.org.mozill
a.javascript.internal.WrappedException
Compiled from "WrappedException.java"
public class sun.org.mozilla.javascript.internal.WrappedException extends sun.or
g.mozilla.javascript.internal.EvaluatorException{
static final long serialVersionUID;
public sun.org.mozilla.javascript.internal.WrappedException(java.lang.Throwa
ble);
public java.lang.Throwable getWrappedException();
public java.lang.Object unwrap();
}
Ok it exists, so here's some test code:
package testapp;
import sun.org.mozilla.javascript.internal.WrappedException;
public class Main {
public static void main(String[] args) {
WrappedException e = new WrappedException(null);
}
}
Netbeans output:
init:
deps-clean:
Updating property file: C:\Documents and Settings\LordQuackstar\Desktop\TestApp\build\built-clean.properties
Deleting directory C:\Documents and Settings\LordQuackstar\Desktop\TestApp\build
clean:
init:
deps-jar:
Created dir: C:\Documents and Settings\LordQuackstar\Desktop\TestApp\build
Updating property file: C:\Documents and Settings\LordQuackstar\Desktop\TestApp\build\built-jar.properties
Created dir: C:\Documents and Settings\LordQuackstar\Desktop\TestApp\build\classes
Created dir: C:\Documents and Settings\LordQuackstar\Desktop\TestApp\build\empty
Compiling 1 source file to C:\Documents and Settings\LordQuackstar\Desktop\TestApp\build\classes
C:\Documents and Settings\LordQuackstar\Desktop\TestApp\src\testapp\Main.java:8: package sun.org.mozilla.javascript.internal does not exist
import sun.org.mozilla.javascript.internal.WrappedException;
C:\Documents and Settings\LordQuackstar\Desktop\TestApp\src\testapp\Main.java:16: cannot find symbol
symbol : class WrappedException
location: class testapp.Main
WrappedException e = new WrappedException(null);
^
C:\Documents and Settings\LordQuackstar\Desktop\TestApp\src\testapp\Main.java:16: cannot find symbol
symbol : class WrappedException
location: class testapp.Main
WrappedException e = new WrappedException(null);
^
3 errors
C:\Documents and Settings\LordQuackstar\Desktop\TestApp\nbproject\build-impl.xml:528: The following error occurred while executing this line:
C:\Documents and Settings\LordQuackstar\Desktop\TestApp\nbproject\build-impl.xml:261: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)
Command line output:
C:\Documents and Settings\LordQuackstar\Desktop\TestApp\src\testapp>javac Main.java
Main.java:3: package sun.org.mozilla.javascript.internal does not exist
import sun.org.mozilla.javascript.internal.WrappedException;
^
Main.java:7: cannot find symbol
symbol : class WrappedException
location: class testapp.Main
WrappedException e = new WrappedException(null);
^
Main.java:7: cannot find symbol
symbol : class WrappedException
location: class testapp.Main
WrappedException e = new WrappedException(null);
^
3 errors
So what would cause this to fail all of a sudden? It was working just fine yesterday. I didn't change anything besides importing 2 more classes from the same package. None of my dependencies changed.
Will test in linux to see if the problem still exists.
Before you say it: No I'm not download rhino separatly, No I'm not changing IDEs,
There are two indications that you shouldn't use this class: sun and internal - these mean that this is some internal class that shouldn't be used by third parties. Because it can change or be removed in future releases - i.e. this is not part of an API. So - download Rhino separately.
If you are using the scripting API - use only the API classes/interfaces - i.e. javax.script
I agree w/ the above advice that you're better off not trying to use the sun internal packages.
This begs the question, how do you access JavaScript arrays w/out sun.org.mozilla.javascript.internal.NativeArray?
What worked for me is code as follows. This creates a Java array called vars based off a JavaScript array called vars.
int varsLength = ((Double)engine.eval("vars.length;")).intValue();
Object[] vars = new Object[varsLength];
for(int i=0; i<vars.length; i++){
vars[i] = engine.eval("vars["+i+"];");
}
I had the same error. You must manually add rt.jar from JRE dir to project libraries. Only this solution seems work. You can also see a tutorial on this approach here by Rob Di Marco
This is an old question now, however when I had this problem, my solution was to do more work in the JavaScript environment and then to return a primitive type (String / Boolean) rather than an object.
Of course, this will not satisfy everyone and all requirements, but it may help in some cases.