I am trying to use Jasmin to convert Jasmin assembly code to a Java class file. Using the Hello World example from here.
The following error is returned:
Exception in thread "main" java.lang.NoSuchMethodError: jasmin.parser.parse()V
at jasmin.ClassFile.readJasmin(ClassFile.java:1160)
at jasmin.Main.assemble(Main.java:81)
at jasmin.Main.run(Main.java:200)
at jasmin.Main.main(Main.java:157)
I suspect that it may be a problem with the Java version since Jasmin seems to be old and probably implemented using an older Java version.
So far I have tried to run the example using this command: java -jar jasmin.jar test.j.
I have tried to run it with Java 8, 7, 6 and 4 unsuccessfully.
The version of Jasmin I have used is 2.4.
Furthermore I have also tried to download Jasmin's source code and compile it manually, with the same result.
Does anybody have any pointers or ideas on how to solve this issue?
The issue is that, if you have other versions of cup in Java's classpath, jasmin might run intro troubles and it will throw a NoSuchMethodError.
To fix this, just remove the other CUP versions from Java's classpath.
All credit goes to #MargaretBloom for finding the issue.
Related
Hy,
I've ported an old 1.6 java desktop application to java 11, a lot of problems concerning jaxb no more supported on jre but at the end the application is running. Actually I've a problem with a jar named gfe.jar especially on class
de.vcs.spc.ett.sdl.SDLParser extends org.xml.sax.helpers.DefaultHandler
in the jar aren't available source files. Do somebody know if it is available a more recent version of this jar that actually is compiled with java 1.6 instead i need it for java 11.
the exception is:
"de.vcs.spc.ett.sdl.UnknownTypeException: Unknown type 'IdentifiedBlock'."
coming from:
final FieldDef fieldDef =
SDL_PARSER.createFieldDef("IdentifiedBlock");
The same code with the same libraries is working well on Linux.
On internet I can't find any information about this.
Thanks
I would like to use jython for basic web scraping task rather than learning java. To learn the basics I'm using an example from http://blog.databigbang.com/web-scraping-ajax-and-javascript-sites/ I've been unsuccessfully trying to run the gartner.py code from Windows cmd. Could anyone suggest a resolution to why both
jython -J-classpath "path\to\the\jars\*" path\to\gartner.py
and
jython path\to\gartner.py
keep on throwing out
Traceback (most recent call last):
File "path\to\gartner.py", line 1, in <module>
import com.gargoylesoftware.htmlunit.WebClient as WebClient
ImportError: No module named gargoylesoftware
given I've got environment variables set up for jython path\to\jython\bin, for java path\to\Java\jdk-14.0.1\bin and for the htmlunit-2.40.0 I've added path\to\jars\htmlunit-2.40.0\lib to the CLASSPATH.
I understand that jython should pick up the specified package in jython -J-classpath "path\to\the\jars\*" path\to\gartner.py but it does not find it. Also, I understand that in the case of jython path\to\gartner.py the defined CLASSPATH variable is available to Java pointing at htmlunit-2.40.0 (as mentioned above) whilst jython serves only as a translator from python to java. So - in my understanding - java shouild have all parameters available to import the desired module. Please, could anyone confirm?
I appreciate this subject has been somewhat discussed but there is no clear resolution available. What could I be missing?
The error looks very clearly like you're missing a Java dependency. The jython issue with this specific library has already been discussed in a different thread: instantiating a webclient object in jython giving strange results
I'm struggling trying to get remote actors setup in Scala. I'm running Scala 2.10.2 and Akka 2.2.1.
I compile using [I've shortened the paths on the classpath arg for clarity sake]:
$ scalac -classpath "akka-2.2.1/lib:akka-2.2.1/lib/scala-library.jar:akka-2.2.1/lib/akka:akka-2.2.1/lib/akka/scala-reflect-2.10.1.jar:akka-2.2.1/lib/akka/config-1.0.2.jar:akka-2.2.1/lib/akka/akka-remote_2.10-2.2.1.jar:akka-2.2.1/lib/akka/akka-kernel_2.10-2.2.1.jar:akka-2.2.1/lib/akka/akka-actor_2.10-2.2.1.jar:." [file.scala]
I've continuously added new libraries trying to debug this - I'm pretty sure all I really need to include is akka-remote, but the others shouldn't hurt.
No issues compiling.
I attempt to run like this:
$ scala -classpath "[same as above]" [application]
And I receive a NSM exception:
java.lang.NoSuchMethodException: akka.remote.RemoteActorRefProvider.<init>(java.lang.String, akka.actor.ActorSystem$Settings, akka.event.EventStream, akka.actor.Scheduler, akka.actor.DynamicAccess)
at java.lang.Class.getConstructor0(Class.java:2810)
at java.lang.Class.getDeclaredConstructor(Class.java:2053)
...
Looking into the source code, it appears that Akka 2.2.X's flavor of this constructor takes 4 arguments (the Scheduler is removed). But in Akka < 2.2.X, the constructor takes 5 args.
Thus, I'm thinking my classpath isn't setup quite right. At compile-time, Scala must be finding the <2.2.X flavor. I don't even know where it would be finding it, since I only have Akka 2.2.1 installed.
Any suggestions!? Thanks! (Please don't say to use SBT).
The problem here is that the Scala distribution contains akka-actor 2.1.0 and helpfully puts that in the boot class path for you. We very strongly recommend using a dependency manager like sbt or maven when building anything which goes beyond the most trivial projects.
As noted in another answer, the problem is that scala puts a different version of Akka into the bootclasspath.
To more directly answer your question (as you said you don't want to use sbt): you can execute your program with java instead of scala. You just have to put the appropriate Scala jars into the classpath.
Here is a spark-dev message about the problem. The important part is: "the workaround is to use java to launch the application instead of scala. All you need to do is to include the right Scala jars (scala-library and scala-compiler) in the classpath."
For whatever reason I had to change pc's as a result of the change I now have to use Java 6 (the final update) Instead of java 7. When importing my existing project to Java 6 I get the following error in my auto generated code that was generated by Netbeans and is not modifiable
cannot find symbol
symbol: variable Type
location: class Window
frame.setType(java.awt.Window.Type.POPUP); //Type is underlined
The output for the error is as follows:
javac: invalid target release: 1.7
Usage: javac <options> <source files>
use -help for a list of possible options
C:\Users\Adminstrator\Downloads\NetBeansProjects\NetBeansProjects\Pat0.3\nbproject\build-impl.xml:915: The following error occurred while executing this line:
C:\Users\Adminstrator\Downloads\NetBeansProjects\NetBeansProjects\Pat0.3\nbproject\build-impl.xml:268: Compile failed; see the compiler error output for details.
What does this do? Is it necessary, would deleting that the component help? Which component is it, is there a quick fix?
Your build.xml specifies the target="1.7" flag to javac, which java 6 doesn't know how to interpret. Changing it to 1.6 will technically get past that error.
However, the enum Window.Type was added in Java 7, so you simply can't expect changing the target to work; your project's source uses Java 7 features. I'm sure that's not the only one.
Your options are therefore to methodically go through and remove/replace all Java 7 code (likely introducing some bugs) or just to.. install Java 7.
There is somewhere in your project a setting for the java compiler that tells it to generate classes for jre7. javac from jdk6 cannot generate classes for that version, hence the error. So you should look into the properties of your project and set up javac to generate classes for jr6. You might also have fix some of your non-generated code if for example you have used features that came with java 7 such as diamond operator or multy catch block etc.
Also the javadoc for Window.Type states it is available only since 1.7. You might want to re-generate that code or better yet just install jdk7.
I am migrating my application from Java 1.4 to Java 1.6 and RSA 7.0 to RSA 8.0
When I am opening my projects which used to be in RSA 7.0, some of the files which are generated from WSDL, getting the following error:
“Syntax error on token , class expected ;
com.ibm.ws.webservices.engine cannot be resolved to a type”
For the below lines:
com.ibm.ws.webservices.engine.enum.Style.WRAPPED
com.ibm.ws.webservices.engine.enum.Use.LITERAL
When we manually changed the class path like below it compiled in 1.6:
com.ibm.ws.webservices.engine.enumtype.Style.WRAPPED
com.ibm.ws.webservices.engine.enumtype.Use.LITERAL
I have tried many option but couldn't find the proper solution. I have also posted the problem in other forum but looks like no solution so far.
I have found the solution to my question by myself, though it took long time, so here is the solution.
change com.ibm.ws.webservice.engine.enum to com.ibm.ws.webservice.engine.enumtype
add "com.ibm.ws.webservices.thinclient_7.0.0.jar" to your classpath and recompile the code.
You can find the "com.ibm.ws.webservices.thinclient_7.0.0.jar" in your <WAS HOME>/runtimes folder
Changing the package structure seems inevitable since enum is a keyword from Java5 onwards.
I have faced a similar issue when I converted a project from Java 1.4 to 1.5