• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Page Information

    Loading...
  1. Dashboard
  2. Undefined Space
  3. Multi-Language VM
  4. BootClassPath

Page History

Versions Compared

Old Version 2

changes.mady.by.user John Rose

Saved on Jul 18, 2008

compared with

New Version 3

changes.mady.by.user John Rose

Saved on Jul 18, 2008

  • Previous Change: Difference between versions 1 and 2
  • Next Change: Difference between versions 3 and 4
  • View Page History

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Coping with the Boot Class Path

Some projects, such as MethodHandles, require us to develop Java code and test cases under packages like java.dyn. Classes in packages under java cannot be loaded by the normal means of setting CLASSPATH or using the -cp flag. The JVM will throw an exception like this:

No Format
titlewhat can happen when you develop in java.dyn
$ java -cp "$mypath" java.dyn.MethodHandleBytecodeTest
Exception in thread "main" java.lang.SecurityException: Prohibited package name: java.dyn

Instead, you must put your classes on the boot class path, as follows:

No Format
titlesuccessfully running your java.dyn code
$ java -Xbootclasspath/a:"$mypath" java.dyn.MethodHandleBytecodeTest
invoke toString
invoke mh=java.dyn.hotspot.VMH@15ff48b
...

If you are running JUnit, you will also need to place the JAR for JUnit on the boot class path. You can fish the JAR out of your NetBeans distribution (e.g., under NetBeans 6.1.app/Contents/Resources/NetBeans/java2/modules/ext), or you can download it from SourceForge.

NetBeans Modifications

In order to run test correctly from inside NetBeans, you have to hack the boot class path. Add the following line to nbproject/project.properties:

No Format
titleNetBeans properties hacking boot class path
run.jvmargs=-Xbootclasspath/a:"${build.classes.dir}:${libs.junit.classpath}"

The quotes are important, since there might be spaces in the path names.

(I would like put the setting in build.xml, so that it will have the required effect outside of NetBeans. No success with this yet.)

Overview
Content Tools
ThemeBuilder

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.21
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 242, "requestCorrelationId": "9f8aba07d3677c78"}