libgdx / libgdx/packr

classpath is empty when retrieving it.

Open
#234 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
2.6k
Forks
174
PR merge metrics
No merged PRs in 30d

Description

I've had some problems with my build for MacOS. Who could have guessed?

Now, I need to retrieve the current classpath to be used in a ProcessBuilder. The reason for this is that I'm appending other classspaths as well as the default one.

But, when querying the classpath on mac, using the exe built by packer, it's empty. Running the jar on the mac works fine though.

It looks like this:

String classpath = System.getProperty("java.class.path");
if (classpath == null || classpath.length() == 0) {
LOG.ln("java.class.path is: '" + classpath + "'");
}

I'm building like so:

java -jar %CD%\packr\packr-all-4.0.0.jar --platform Mac --jdk %CD%\jre\javaMac.zip --executable songsofsyx --classpath SongsOfSyx.jar --mainclass init.MainLaunchLauncher --vmargs XstartOnFirstThread --resources %CD%\build\songsofsyx\base --output %CD%\out\SongsOfSyxMac\SongsOfSyxMac.app --icon %CD%\jre\icon512.icns

Now, I've tried reading the executable, but it's all just a bunch of binary data there. In the end, the executable should be doing something like this path/java -jar Myjar.jar cp - something... What do you set the cp to?

I'm also guessing double clicking a jar is this path/java -jar Myjar.jar cp - path/clickedJar.jar.

Could also be possible that if the cp argument is missing, the JVM will find it itself?

I realize this might not be a bug, but maybe someone could shed some light on these mysteries?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how packr-all-4.0.0.jar uses the --classpath argument when creating the Mac executable, then compare that launch path with running SongsOfSyx.jar directly. Check how init.MainLaunchLauncher obtains java.class.path and how the executable invokes Java. Done means the packaged Mac application exposes the expected classpath for ProcessBuilder, or the limitation is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.