I am using import javax.swing.JOpti开发者_StackOverflowonPane
in my project and I need rt.jar for that since rt.jar contains javax.swing
. But rt.jar is a runtime jar and I cannot add it because adding it gives me a dalvik error when I compile my project.
So is there any other way to solve this or get javax.swing
from any other jar?
Dalvik doesn't run un-modified Java classes. Dalvik is not Java!
And even if it did, Swing (or more precisely, the underlying AWT) has native components that need support from the JVM.
And even if that were not a problem, the classes in rt.jar
are the classes that make up the Java platform implementation. You can't just swap out the rt.jar
of one JVM with that of another one. They are tightly coupled with the JVM implementation.
How are you trying to run your project? Through an IDE such as Eclipse or command line? If you're doing through command line and need rt.jar to compile, your installation is toast!
If you're using Eclipse, you need to add a Java System Library to your project's build path.
精彩评论