• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Java Debugger API example - Trace.java running problem

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to run Trace.java program that comes as a sample as part of Java Debugger Interface. This program provides command line trace of any input java program to it. It expects the name of java program to be traced as parameter.
This Trace.java is located in package "com.sun.tools.example.trace". The online location of Trace.java is at :- http://www.docjar.com/html/api/com/sun/tools/example/trace/Trace.java.html

And I pass another class to be traced as argument to this program called as Client.java which is located at package "com.sun.tools.example.trace". Both Trace.java and Client.java are part of same java project. Now when I try to run Trace.java using argument "com.sun.tools.example.trace.Client" I get below exception in my console:-

java.lang.NoClassDefFoundError: com/sun/tools/example/trace/Client
Caused by: java.lang.ClassNotFoundException: com.sun.tools.example.trace.Client
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: com.sun.tools.example.trace.Client. Program will exit.
Exception in thread "main" -- VM Started --
-- The application exited --


Any idea why I am getting this error though Client.java is present at correct path as provided in argument to Trace.java?

Many thanks in advance.

-Pras
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you including the com.sun.tools.example.trace.Client class in the classpath? In other words, what command are you running, and what is the layout of the involved files and directories?
 
Pras Tiwari
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using eclipse IDE to tun this application:-

I am passing argument "com.sun.tools.example.trace.Client" as "Program Arguments" in "Arguments" tab of "Run Configuration". Then with this Run Configuration I run "Trace.java" as java program.

My java project structure in eclipse is:-

jdb --> Java project Name
--src --> Source Directory
--com.sun.tools.example.trace
--Trace.java
--Client.java

And output directory for this project is:- jdb/bin


 
Pras Tiwari
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any idea about this? Anybody?

Regards,
Pras
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's quite late for an answer. But anyway, I think the required classpath is not passed thru your remote vm (the one which runs your program under trace). Or in other words you must provide the remote vm with the required classpath. This is not done in the example application. Have a look at this example at connectorLaunchArguments(...)

https://svn.strategoxt.org/repos/StrategoXT/spoofax-imp/trunk/org.strategoxt.imp.debug.stratego.core/src/org/strategoxt/debug/core/util/VMLauncherHelper.java
 
Marshal
Posts: 80123
416
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch Max Keller.
 
We don't have time to be charming! Quick, read this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic