Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Java Basics
|
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 2nd, 2009, 05:42 AM
Registered User
 
Join Date: Jun 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default java exec problem with class path

Hello, I'm trying to execute java program from another java application:
Process process = Runtime.getRuntime().exec(commandLine);
When the commands looks like:
java -cp my_class_path org.jetel.main.runGraph parameters
everything works properly, but when the my_class_path is quoted:
java -cp "my_class_path" org.jetel.main.runGraph parameters
I get error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/jetel/main/runGraph
More over the last command:
java -cp "my_class_path" org.jetel.main.runGraph parameters
is executed properly when running from command line.
I have SUSE OS and java 1.6, but the application, that calls the exec method runs with java 1.5
Did anyone fence the above problem? What could help?
 
Old June 16th, 2009, 06:08 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Try escaping the double quotes, use '\"'
__________________
- Rakesh
http://iam-rakesh.blogspot.com
 
Old June 16th, 2009, 06:16 AM
Registered User
 
Join Date: Jun 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It is of course escaped. It helped executing exec(String[]) instead of exec(String)





Similar Threads
Thread Thread Starter Forum Replies Last Post
exec:java classpath problem mslinn BOOK: Beginning Spring Framework 2 ISBN: 978-0-470-10161-2 2 December 1st, 2008 08:05 AM
FileInfo Class Path Problem kwilliams VB.NET 6 April 18th, 2007 11:14 AM
Problem in setting java.library.path kuldeept Apache Tomcat 0 March 22nd, 2005 03:50 AM
Class path setting pedr0 BOOK: Beginning Java 2 5 July 26th, 2004 03:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.