Bug 569051 - JarInJarLoader returns \ for valid jar files
Summary: JarInJarLoader returns \ for valid jar files
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: APT (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows 10
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Generic inbox for the JDT-APT component CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-23 01:14 EST by jredfox john CLA
Modified: 2022-12-31 14:47 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jredfox john CLA 2020-11-23 01:14:34 EST
String jarPath = mainClass.getProtectionDomain().getCodeSource().getLocation().getPath();//get the path of the currently running jar
            	String filename = URLDecoder.decode(jarPath, "UTF-8").substring(1);

this code without the jar in jar loader will return the absolute path of your jar in eclipse. Once compiled with the option to embed libraries as jars in your jar it will now print "\" instead of the file. Also switching the option to embedding libraries instead of packaging the jars will fix the issue proving it's your jar in jar loader that's the issue. I understand you needed to modify the absolute path for jars that are inside of jars but, you shouldn't mess with jars that are actual files. Please fix this it's annoying to work around.

I had to do this as a workaround for my program
            	boolean compiled = getExtension(new File(filename)).equals("jar") || getMainClass().getName().equals("org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader");

Since this has to do with java jar in jar loader program it effects all os's and should be fixed asap
Comment 1 Eclipse Genie CLA 2022-12-31 14:47:37 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.