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

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

BootClassPath

  • Created by John Rose, last modified on Jul 18, 2008

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:

what 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:

successfully 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:

NetBeans 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
  • No labels

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": 248, "requestCorrelationId": "24828a354687d640"}