Is BCEL(Byte code Engineering Library) directly usable in normal java 1.6 or we need to download something for using it?
Or is this an in built library in java1.6?
It's not built in at all. You'll have to add the BCEL JARs to your CLASSPATH and write code in your app to use it.
I would not use BCEL. It seems to be more or less dead. Use ASM instead.
They are in com.sun packages, I would avoid the ones which come with the jdk; I agree with
both jmg and duffymo
Related
I need to rewrite some java 7 file IO code that should run on a Java 6 VM too.
The implementation uses handy Java 7 features like autoclosing, Paths and Files.
To be more specific, I need to handle expressions like /tmp/foo/*.bar to return all .bar files (currently implemented with Files.newDirectoryStream(dir, glob)).
Does anyone know a handy library for this?
The Apache Commons IO API is also a good choice. I used it for a similar work (rewrite some code from java7 to java6 that used Path object) and they work very well.
The Apache Ant API would be a good candidate for this, in particular their FileSet class might do the job.
guava runs on java6 and it has a nice I/O api.
I want to develop a small Java program using some input like the pen of a Wacom graphictablet and found only the very active JPen project but are there some more possible alternatives without JNI or JNA (without any additional needed dll files), a pure Java implementation?
You can take a look at JTablet. From another SO thread.
It seems JPen moved to GitHub and this might be the best solution at the moment.
The other alternative solutions are not developed and maintained anymore.
https://github.com/nicarran/jpen
I am looking for something similar to what the Reflector VS plugin does for .NET
IntelliJ IDEA 14 comes with a built-in Java decompiler:
http://blog.jetbrains.com/idea/2014/07/intellij-idea-14-eap-138-1029-is-out/
Now you can download a preview version from their official website.
Doing a quick google I found
http://java.decompiler.free.fr/?q=jdintellij
http://sourceforge.net/projects/ideajad/
http://plugins.intellij.net/plugin/?id=126
http://code.google.com/p/intellijad/
I know Netbeans does something like this - just click on a .class file of a dependency and it'll do it automatically. It doesn't produce Java Source, but the comments give a pretty good idea of what is going on for simple operations.
Basically, I need to run Groovy Scripts to manipulate Java objects, and GroovyShell / GroovyScriptEngine seems to be the best way to do so. Is it possible to embed Groovy inside a Java App? I tried placing the groovy-all-1.8.2.jar into my Android Java App's libs folder, referenced it then hit compile but I got a bunch of errors.
How do I do this?
I don't believe this will work. Groovy converts scripts to bytecode, and as the Dalvik bytecode is different to the Java bytecode that Groovy expects, I believe it will have problems...
The Discobot from a few years ago has been resurrected though, and great progress is being made so there is hope on the horizon.
But that doesn't help you today...
In near future it will be possible: http://skillsmatter.com/podcast/home/groovy-android/
I have found it recelty.
You can find the solution from http://melix.github.io/blog/2014/06/grooid.html.
Check it http://glaforge.appspot.com/article/groovy-2-3-3-and-groovy-2-4-beta-1-with-android-support too!
Since 09/2011, Discobot seems to be stuck. The last results seem to be : most of it works, but this is very slow.
Groovy 2.0 is out now, and Guillaume Laforge (insider) says it could helps - especially because of the #CompileStatic new feature of Groovy 2.0. Since then, Groovy 2.0.1...2.0.4, it looks that static compilation got a lot of bugfixes.
But for now, on the official website of Groovy, Android is not discussed, nobody seems to really be in charge (see wiki and wiki).
Here is an example of what you are trying to accomplish. https://github.com/melix/grooidshell-example
It is pretty slow since it has to first compile to class files on the android device and then convert them to dex, but it will accomplish what you are looking for.
A better choice for running scripts on Android is SnapScript. It does not rely on Bytecode and is fully supported on Android.
I have a java code and created a jar file.
I need to create an Qt application. Can I use this code in that application?
Please help me how can i use that jar file.
Thanks,
Nagaraju.
You could take a look at the capabilities of GCC/GCJ (see http://gcc.gnu.org/ ). IF it's a good idea is a whole other story, and depends on what you have, and what you're trying to accomplish. It should be doable to link SO's created with GCJ in QT applications, but I seriously wonder if you are not better off using either C++ or Java, but not mixing them
If your Java code takes input from stdin or some file and writes output to stdout or some file, then the easiest way is to fork java to run that jar, and parse the output in your Qt code.
Things other than that, you'll need to be a bit specific. Something like "my Java code does painting the screen".
My advice is to use SWT or Swing.
You can use gcj gcj to compile the java code to library and simply call the functions of the java code from your C code.
Yes, you can use your jar file in your Qt application. I've done exactly this myself.
One way is to use the JNI Invocation API. This is part of the Java Native Interface (JNI), which makes it feasible but not pleasant to access Java APIs from C++.
A much more pleasant approach is to use CodeMesh JunC++ion, which wraps the Java APIs in C++ classes. This is a great product, if you can afford it.
If you have very little Java code, it may be easier to port it to C++.