Unity-Android _ CommandInvokationFailure: Unable to convert classes into dex format - java

i'm using Windows 7, jdk 1.8.0 (64bit), jre 8 (64bit), Unity Pro 4.3.4f1 and Android SDK 22.6.1
All are updated softwares.
All works fine but when i use StartApp sdk, this error comes. No extra plugin is used, only the SDK provided by the StartApp ad.
Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
C:\Program Files\Java\jdk1.8.0\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="D:/android-sdks\tools" -Dfile.encoding=UTF8 -jar "C:/Program Files (x86)/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -
stderr[
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/unity3d/player/a$1;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:685)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
at com.android.dx.command.dexer.Main.access$600(Main.java:78)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at SDKMain.main(SDKMain.java:129)
1 error; aborting
]
I already tried JAVA_OPT and JAVA_HOME solutions. But still couldn't solved

I ran into this using IntelliJ 13.1.4, JDK 1.6 but I would guess that this is caused by the same thing on any other IDE -> classes.jar is referenced/included more than once.
Check and make sure that the classes.jar you added to the project (from Unity\Editor\Data\PlaybackEngines\androidplayer\bin\classes.jar) isn't referenced/included more than once. If you go into File->Project Structure:
There should only be one "classes" under libraries.
There should be NO reference to classes under Artifacts (Artifacts is used to create the plugin .jar file.)
Check out this related answer ->
https://stackoverflow.com/a/8437996/3464367

My issue was actually related to having duplicate files. Well not really duplicates, but I had 2 adMob sdk packages (different versions), that were getting into conflict. After deleting the older one, everything was fixed. Are you using any 3rd party SDK's or something similar, if so, try removing them if possible and see if the issue persists. Try to find out which part of the code is causing this to happen. You could ultimately try to compile an empty project just for testing.

Today I solved similar problem of Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details. with adding .jar file into Plugins\Android\
I got different kind of errors:
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000 ...
Caused by: com.android.dx.cf.iface.ParseException: class name (ht/stringing/test) does not match path (src/ht/stringing/test.class)
My result working solution was similar to this:
Code lives here:
verysimple\src\ht\stringing\test.java
I do:
> javac -classpath "c:\Android\sdk\platforms\android-15" ht\stringing\test.java
> jar cvf ..\dist\verysimple.jar ht\stringing\test.class
> copy ..\dist\verysimple.jar c:\ExUnityApp\Assets\Plugins\Android
Don't forget to compare your 'Minimum Api Level' in Player Setting. For me it was Android 4.0.3 ... (15)

Related

"java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema" when accepting SDK licenses

Alright so I'm trying to build my React-Native app using Android Studio. I first ran into this error when building:
Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;29.0.2 Android SDK Build-Tools 29.0.2
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: C:\Users\jaspe\AppData\Local\Android\Sdk
When figuring that out I came across this answer which told me to accept the licenses. However in trying to do so I got the following error:
C:\Users\jaspe\AppData\Local\Android\Sdk\tools\bin>sdkmanager --licenses
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more
To resolve which I found this post. I don't use brew, but I tried the second answer. It didn't work, sadly enough. Then I found out I didn't have a JDK installed, so I did that. But with the newest JDK installed I still get an exception:
C:\Users\jaspe\AppData\Local\Android\Sdk\tools\bin>sdkmanager.bat -licenses
Error occurred during initialization of boot layer
java.lang.module.FindException: Module java.xml.bind not found
And now I'm not sure what to do anymore. I found an answer explaining I needed to edit my project settings, but I think this doesn't apply to my project, and honestly I'm in a bit over my head. Does someone have experiences with these errors, and can help me fix them? I've spent the whole morning trying to figure this out, I'd expected building a runnable .APK as a demo would be easier...
You are using the wrong sdkmanager, tools directory has been deprecated
Open Android Studio and install the latest command-line tools:
This will create this folder in your Android SDK:
...\Android\Sdk\cmdline-tools\latest\bin
Now use the sdkmanager which is inside the bin directory to accept all the licenses:
C:\Users\jaspe\AppData\Local\Android\Sdk\cmdline-tools\latest\bin>sdkmanager.bat --licenses
#MatPag's answer has the solution I needed, but it took me a while to recognise it. Posting this answer for a specific case incase it helps someone else.
I was trying to setup Unreal Engine v4.25.4 when I encountered this error. I needed to run a batch script that came with Unreal Engine located at:
C:\Program Files\Epic Games\UE_4.25\Engine\Extras\Android\SetupAndroid.bat
which produced the error:
Android Studio Path: C:\Program Files\Android\Android Studio
Android Studio SDK Path: C:\Users\brianb\AppData\Local\Android\Sdk
Using sdkmanager: C:\Users\brianb\AppData\Local\Android\Sdk\tools\bin\sdkmanager.bat
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more
Update failed. Please check the Android Studio install.
Press any key to continue . . .
Even after I located the sdkmanager.bat script and executed it according to MatPag's answer, my AndroidSetup.bat script was failing.
Eventually I realised the AndroidSetup.bat was trying to call the sdkmanager.bat from the wrong location.
I edited the AndroidSetup.bat file (line 61) as follows to correct the path:
:: set SDKMANAGER=%STUDIO_SDK_PATH%\tools\bin\sdkmanager.bat
set SDKMANAGER=%STUDIO_SDK_PATH%\cmdline-tools\latest\bin\sdkmanager.bat

OpenCV build to java, not generating a java folder in build

I am trying to build OpenCV from source to .jar, since I need to have some contributed libs like Aruco (and these do not come with the default download from OpenCV.
Following a tutorial, I set up CMake, and configuring gives the following (pieces of) output:
OpenCV modules:
To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann fuzzy hfs highgui img_hash imgcodecs imgproc java java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python_bindings_generator reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
Disabled: js python3 world
Disabled by dependency: -
Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv dnn_modern freetype hdf matlab ovis python2 python2 sfm viz
Applications: perf_tests apps
Documentation: NO
Non-free algorithms: YES
...
Java:
ant: C:/opencv-3.4.1/apache-ant-1.10.5-bin/bin/ant.bat (ver 1.8.0)
JNI: C:/Program Files/Java/jdk1.8.0_171/include C:/Program Files/Java/jdk1.8.0_171/include/win32 C:/Program Files/Java/jdk1.8.0_171/include
Java wrappers: YES
Java tests: NO
Then after I run mingw32-make in the build folder configured by CMake, it builds without errors. Then in the build/bin folder I do find the opencv-341.jar file as expected.
When I link this library in my IntelliJ IDEA, the modules like org.opencv.aruco are recognised, as expected. However when trying to build the java project, I get this error:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.UnsatisfiedLinkError: no opencv_java341 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at AraInvaders.Main.main(Main.java:24)
... 11 more
After some research I figured that I forgot to link the native library location, as was also described in the tutorial. However according to that tutorial (and other resources), the build should include a build/java/x64 folder, containing a .dll file, however there is no build/java folder at all.
I do find a libopencv_java341.dll in build/lib however, linking that file does not resolve the problem. Image showing that .dll file is linked
When I download the Windows package form OpenCV, there is a Java folder in the build folder, and that does include the .jar file and an /x64 folder, however, those do not include the contributed libs, so that is why I am trying to build from source.
So the question is, what should I do to correctly setup the OpenCV library, including the contributed libs?
I asked on OpenCV forum http://answers.opencv.org/question/210451/opencv-401-face-module-for-java/.
So there are two solutions:
Since you built dynamically OpenCV libs, opencv_java.dll depends on opencv_core.dll, opencv_imgproc.dll, etc... you have to append the folder containing those to your system's PATH
Turn off BUILD_SHARED_LIBS flag and build everything again.
I renamed the generated dll from libopencv_java412.dll to opencv_java412.dll and it resolved the problem of library path problem ("UnsatisfiedLinkError").
The 412 in the file name is because I'm using OpenCV 4.1.2.

Ionic error on android emulate

I have installed java JRE but i keep on getting. Am using windows 10 for development
After running ionic run android or ionic emulate android i get this error:
Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:215)
at java.util.zip.ZipFile.<init>(ZipFile.java:145)
at java.util.zip.ZipFile.<init>(ZipFile.java:159)
at org.gradle.wrapper.Install.unzip(Install.java:160)
at org.gradle.wrapper.Install.access$400(Install.java:29)
at org.gradle.wrapper.Install$1.call(Install.java:70)
at org.gradle.wrapper.Install$1.call(Install.java:47)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
... 3 more
I have also set JRE_HOME in the environment variables
Probably it is related to something missing or corrupted.
You can find a similar question here, hope it helps.
First of all you have to install
node.js
apache ANT
JDK & JRE
Android SDK & Eclipse
After installation, you have to set software paths into environmental- variable. Then fire your npm install -g cordova. Without this PhoneGap will not be created.

RNetLogo works on R3.1.1.0?

When I try to launch the RNetLogo from R using the function NLStart(). I get messages about java and the GUI does not open. I am using MacOsX 10.9.5 64-bit, NetLogo 5.1.0, and R 3.1.1.
> library(rJava)
> library(RNetLogo)
> nl.path <- "/Applications/NetLogo\ 5.1.0/NetLogo\ 5.1.0.app"
> NLStart(nl.path, nl.version=5, gui=FALSE)
java.lang.NoClassDefFoundError: org/nlogo/workspace/Controllable
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
Caused by: java.lang.ClassNotFoundException
at RJavaClassLoader.findClass(RJavaClassLoader.java:383)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 2 more
After that I try with "JGR and Deducer and deducer extras”.
The code and errors are:
> install.packages(c("JGR","Deducer","DeducerExtras”))
> Sys.setenv(NOAWT=1)
> library(JGR)
> Sys.unsetenv("NOAWT")
> JGR()
When start JGR the code is:
Loading required package: JGR
Loading required package: rJava
Loading required package: JavaGD
Loading required package: iplots
starting httpd help server ... done
Loading required package: RNetLogo
Loading required package: DeducerExtras
Loading required package: Deducer
Loading required package: ggplot2
Use suppressPackageStartupMessages to eliminate package startup messages.
Loading required package: car
Loading required package: MASS
Attaching package: ‘Deducer’
Loading required package: irr
Loading required package: lpSolve
> nl.path<-"/users/Pabolo/Applications/NetLogo\ 5.1.0/NetLogo.jar"
> NLStart(nl.path)
Error on setwd(nl.path) : you can not change the working directory.
With nl.path be the path to the app dir.
There are some errors.
I running all these over JGR().
> nl.path<-"/Applications/NetLogo\ 5.1.0"
> NLStart(nl.path)
Warning: ch.randelshofer.quaqua.util.OSXPreferences failed to load /Users/Pabolo/Library/Preferences/.GlobalPreferences.plist
java.io.IOException: parseReal: unsupported byte count:128
at ch.randelshofer.quaqua.util.BinaryPListParser.parseReal(BinaryPListParser.java:703)
at ch.randelshofer.quaqua.util.BinaryPListParser.parseObjectTable(BinaryPListParser.java:424)
at ch.randelshofer.quaqua.util.BinaryPListParser.parse(BinaryPListParser.java:315)
at ch.randelshofer.quaqua.osx.OSXPreferences.readPList(OSXPreferences.java:176)
at ch.randelshofer.quaqua.osx.OSXPreferences.updateCache(OSXPreferences.java:99)
at ch.randelshofer.quaqua.osx.OSXPreferences.ensureCached(OSXPreferences.java:90)
at ch.randelshofer.quaqua.osx.OSXPreferences.get(OSXPreferences.java:79)
at ch.randelshofer.quaqua.osx.OSXPreferences.getString(OSXPreferences.java:45)
at ch.randelshofer.quaqua.BasicQuaquaLookAndFeel.initSystemColorDefaults(BasicQuaquaLookAndFeel.java:151)
at ch.randelshofer.quaqua.leopard.Quaqua15LeopardLookAndFeel.initSystemColorDefaults(Quaqua15LeopardLookAndFeel.java:208)
at ch.randelshofer.quaqua.BasicQuaquaLookAndFeel.getDefaults(BasicQuaquaLookAndFeel.java:76)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:520)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:564)
at org.nlogo.swing.Utils.setSystemLookAndFeel(Utils.java:41)
at org.nlogo.app.App.<init>(App.scala:302)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:147)
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:332)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:272)
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:354)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:692)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:646)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:671)
at org.nlogo.app.App$.main(App.scala:140)
at org.nlogo.app.App.main(App.scala)
at nlcon.NLink_v5.<init>(NLink_v5.java:96)
at org.rosuda.JRI.Rengine.rniRunMainLoop(Native Method)
at org.rosuda.JRI.Rengine.run(Rengine.java:640)
unable to find translation for: edit.viewSettings.2D.frameRate in GUI_Strings for locale: es
unable to find translation for: edit.viewSettings.2D.frameRate.info in GUI_Strings for locale: es
>
You have to change your path to: nl.path <- "/Applications/NetLogo 5.3/app".
They have changed the directory structure so that the netlogo jar file is now in an 'app' subdirectory.
Source: https://stackoverflow.com/a/34837036/468305
Hope that helps, it worked for me.
It says you can not change your working directory. Maybe start a new session. Also one of your backslashes is going the wrong way.
To find your NetLogo path try file.choose() and then navigate to the NetLogo Jar file. Then when you open the path to file will show in R studios console. Copy the file path into the NLStart command which should look something like below.
file.choose()
NLStart("C:\\Program Files\\NetLogo 6.2.0\\app", gui = TRUE, nl.jarname = "netlogo-6.2.0.jar")
Finally, make sure your Java, NetLogo and R are all running on 64 bit (works for me) or 32 bit but try not to mix. Finally try and run code directly from R GUI instead of RStudio. This helped the first time I opened Netlogo with R.
I have a youtube video (https://www.youtube.com/watch?v=zWMdaTEPTOc) explaining how to open NetLogo from R and all my functional code (August 2021) can be found here.

Java SQLite org.sqlite.JDBC classpath broken?

I stumbled upon a weird error while using JDBC sqlite with org.sqlite.JDBC
my code compiles and runs fine on Windows.
But when I tried moving it to Ubuntu it started showing this:
Exception in thread "main" java.lang.ClassNotFoundException: org.sqlite.JDBC
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:259)
at mall.SQLiteJDBC.<init>(SQLiteJDBC.java:27)
at mall.AllegroReader.<init>(AllegroReader.java:33)
at mall.Mall.main(Mall.java:31)
I'm running it with java -classpath "sqlite-jdbc-3.7.2.jar" -jar Mall.jar" and java -classpath "sqlite-jdbc4-3.8.2-SNAPSHOT.jar" -jar Mall.jar
with both versions in the same directory as my jar and I've tried a dozen different options specifying classpath and it behaves exactly the same. I tried openjdk and oracle jdk.
I tried rebuilding it on Ubuntu, changing ant .xmls, changing paths, etc.
I have no idea what is going on. Pls help.
Here is what happens inside my dist directory:
work1#workwork:/var/www/mall/dist$ ls
mall.db Mall.jar Mall.jar.old sqlite-jdbc-3.8.4.3-SNAPSHOT.jar
work1#workwork:/var/www/mall/dist$ java -classpath "sqlite-jdbc-3.8.4.3-SNAPSHOT.jar:Mall.jar" Mall
Error: Could not find or load main class Mall
The classpath is ignored when you use -jar.
You have to either include the dependencies in the jar (or at least have the jar manifest point to them), or run it with -classpath sqlite.jar:Mall.jar the.main.class.
Error: Could not find or load main class Mall.main. all files are there,
my main class comes from Mall.java and is in mall package which
compiles to Mall.jar
So the correct command line is:
java -classpath "sqlite-jdbc-3.8.4.3-SNAPSHOT.jar:Mall.jar" mall.Mall
OP findings
to view the classes in jar use jar tf Mall.jar - from this I got mall/Mall.class meaning my class containing main was mall.Mall
it showed
mall/Mall.class
so I should have used mall.Mall as the class to run (instead of pulling my hair)
After spending over 6 hours total with many failed attempts at running "portable" jar package using classpath and whatnot, after having tried OneJar and jarjar to no avail (ended up with Class file too large!) I decided to write the offending piece of code in PHP.
It proved to be more portable than Java in my case.

Categories

Resources