Open gchauvet opened 11 years ago
I have an idea what the problem is. Thanks.
Do you have news about this issue ? Regards,
I am running into exactly the same issue. As a workaround, I am using a Main class in the default package since the error indicates you give the findClass method a binary name (slashes) and not a fully qualified name. Using the default package makes the binary name equal to the fqn.
An easy fix is to replace the name given to defineClass with null, this is generally accepted by the class loaders. However, the best solution is to change the native code.
Thanks for the info. Will try to get a fix out shortly.
Any news on this? Is the project still maintained? It happens only when using the jar embedding, btw.
Also having this issue.
I am also having this issue, have downloaded the fix as linked above am having trouble trying to compile it as I can only download the source. Can somebody provide a new compiled version of WinRun4J with this fix? or help me with how I go about compiling the downloaded source code?
@lavo140, create a class in the default package with a main method and use that to start your app. Or use JSmooth.
Will try using the default package trick. WinRun4J is the perfect solution for me as I need to have an executable to be run as both a service and an application. I like that WinRun4J provides wrappers for both.
While on the topic of this, is there a simple fix as to why the launcher seems to be ignoring when I use the -Wservice.mode=false switch on the command line? I have both service.class and main.class specified in the ini file and I thought I would be able to determine which mode the executable starts in using this command line switch but it seems to make no difference and always tries to load as a service? If it's something I'm doing wrong then let me know, or should I open it as a separate issue?
Many Thanks.
JSmooth and Launch4j can also do a service. I found both tools have problems and don't seem to be maintained anymore. :( Launch4j is actually being maintained now, but unfortunately it launches Java in a separate process which I really don't like. There doesn't seem to be a single native launcher tool that has all the features I want. If Launch4j is otherwise good, maybe the best bet would be to add launching the JVM in the same process.
I am in the same situation as you. I simply want to embed my jar into an exe and have it run as either a service or application with different entry points, using a command line switch to choose modes. WinRun4J advertises being able to do all this but the bugs, and lack of support for fixing them in new releases, lets it down.
I will try and find an alternative and let you know how I get on!
Keep in mind there are a few winrun4j field you could try. Check their commit logs and see which has the fixes you want. On Nov 7, 2014 5:58 PM, "lavo140" notifications@github.com wrote:
I am in the same situation as you. I simply want to embed my jar into an exe and have it run as either a service or application with different entry points, using a command line switch to choose modes. WinRun4J advertises being able to do all this but the bugs, and lack of support for fixing them in new releases, lets it down.
I will try and find an alternative and let you know how I get on!
— Reply to this email directly or view it on GitHub https://github.com/poidasmith/winrun4j/issues/45#issuecomment-62175349.
What is the change? I have made builds of WinRun4J recently based on my fork. My build embeds the MS VC runtime however, since I couldn't get it working with the mini-runtime. I'm not sure what the legal issues with that would be.
@poidasmith What became of this ticket? Was there a fix? Is something preventing us from incorporating the fix from @NathanSweet ? I am hitting this same issue and disheartened to see a 6 year old thread with no apparent resolution.
WinRun4J is not maintained anymore. JSmooth also (the installer is crashing on my Windows 10). Unfortunately it seems it's the only one able to "replace" the java.exe name with the one specified so we'll juste have to live with it (unless able to recompile it, which looks like a mess...).
Hello,
I obtain a NoClassDefFoundError "IllegalName" with Winrun4j 0.4.5. Please find below, the whole draft configuration.
Regards, Guillaume
TEST.ini:
working.directory=. main.class=com.Test vm.heapsize.preferred=512 single.instance=process process.priority=above_normal vmarg.1=-XX:+UseConcMarkSweepGC vmarg.2=-XX:+CMSClassUnloadingEnabled vmarg.3=-XX:+CMSPermGenSweepingEnabled vm.version.min=1.6.0_43 vm.version.max=1.6.0_45
Linkage:
RCEDIT64.exe /C TEST64.exe RCEDIT64.exe /N TEST64.exe TEST.ini RCEDIT64.exe /I TEST64.exe TEST.ico RCEDIT64.exe /J TEST64.exe test.jar
Output:
C:\Program Files\Test>TEST64.exe C:\Program Files\Test>[info] Module Name: C:\Program Files\Test\TEST64.exe [info] Module INI: C:\Program Files\Test\TEST64.ini [info] Module Dir: C:\Program Files\Test\ [info] INI Dir: C:\Program Files\Test\ [info] Working directory set to: C:\Program Files\Test [info] Configured vm.location: (null) [info] Found VM: C:\Program Files\Java\jre6\bin\server\jvm.dll [info] Generated Classpath: [info] VM Args: [info] vmarg.0=-XX:+UseConcMarkSweepGC [info] vmarg.1=-XX:+CMSClassUnloadingEnabled [info] vmarg.2=-XX:+CMSPermGenSweepingEnabled [info] vmarg.3=-Djava.class.path= [info] vmarg.4=-Xmx512m [info] Registering natives for Native class [warn] Could not find Native class [err] Could not find or initialize main class java.lang.NoClassDefFoundError: IllegalName: com/Test at java.lang.ClassLoader.preDefineClass(Unknown Source) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at org.boris.winrun4j.classloader.EmbeddedClassLoader.findClass(Embedded ClassLoader.java:98)