Createprocess Error 193 Java
Contents |
New Topic programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering Languages Frameworks Products This Site Careers java.io.ioexception createprocess error=193 1 is not a valid win32 application Other all forums Forum: Java in General createProcess error=193, %1 is java createprocess error 2 not a valid win 32 application syed vaseem Greenhorn Posts: 6 posted 5 years ago Error:Cannot createprocess error 193 eclipse run program "C:\Users\x\Desktop\jannotatix.jar" (in directory "C:\Users\x\Desktop"); createProcess error=193, %1 is not a valid win32 application. This above error i am getting when i select a jar file createprocess error 193 1͗løèwin32 avp from the path mentioned above but it's working fine with exe files, i am able to execute successfully exe files but when i try to do for jar files the above mentioned error i get... please help me out asap. This is my part of project which is used to calculate time n memory used
Java Createprocess Error 206
to execute an exe file and jar file. Here goes the code.... package gui; import java.io.PrintStream; import javax.swing.*; import javax.swing.filechooser.FileSystemView; import java.io.File; public class ExecutableAnalyzer { public long getRunningTime(String filename) { long startTime,endTime,exetime; Runtime r = Runtime.getRuntime(); Process p = null; String command; FileSystemView filesys = FileSystemView.getFileSystemView(); File[] roots = filesys.getRoots(); filesys.getHomeDirectory(); int extension_index=filename.lastIndexOf('.'); String extension=filename.substring(extension_index); JOptionPane.showMessageDialog(null,filesys.getHomeDirectory()); File dir = new File(filesys.getHomeDirectory().toString()); if(extension.equalsIgnoreCase("jar")) { command="java -jar "+filename; } else { command=filename; } startTime=System.currentTimeMillis(); try { JOptionPane.showMessageDialog(null,command); p = r.exec(command,null,dir); p.waitFor(); } catch(Exception e) { JOptionPane.showMessageDialog(null,"Error:"+e.getMessage()); } endTime=System.currentTimeMillis(); exetime=endTime-startTime; return exetime; } public long getMemory(String filename) { long usedmemory; Runtime r = Runtime.getRuntime(); Process p = null; String command; File dir = new File("C:\\"); int extension_index=filename.lastIndexOf('.'); String extension=filename.substring(extension_index); if(extension.equalsIgnoreCase("jar")) { command="java -jar "+filename; } else { command=filename; } try { p = r.exec(command,null,dir); p.waitFor(); } catch(Exception e) { JOptionPane.showMessageDialog(null,"Error:"+e.getMessage()); } usedmemory=r.totalMemory()-r.freeMemory(); return usedmemory; } } please help me out asap... it's working fine with .exe files but for jar files it shows the error
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn
Java Processbuilder Createprocess Error 2
more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags createprocess error=193 1 is not a valid win32 application maven Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, jenkins createprocess error=193, %1 is not a valid win32 application helping each other. Join them; it only takes a minute: Sign up java.io.IOException: Cannot run program ": CreateProcess error=193, %1 is not a valid Win32 application up vote 0 down vote favorite I fixed my file path https://coderanch.com/t/536837/java/java/createProcess-error-valid-win-application but now getting this error when trying to run a shell script from java in Eclipse. I just created a text file on my local and wanted to see if it will run. new ProcessBuilder("C:/Users/myDir/Desktop/ss1.sh").start(); java shell share|improve this question asked Aug 26 '14 at 17:05 Doc Holiday 2,4561847102 add a comment| 1 Answer 1 active oldest votes up vote 3 down vote accepted You cannot run a shell script on Windows directly as it is http://stackoverflow.com/questions/25511402/java-io-ioexception-cannot-run-program-createprocess-error-193-1-is-not-a no executable in the Windows sense (only .exe, .com, .cmd and .bat are executables). Call bash.exe or sh.exe and use your script as the first parameter. share|improve this answer answered Aug 26 '14 at 17:07 MrTux 9,959102458 what does that look like? –Doc Holiday Aug 26 '14 at 17:52 new ProcessBuilder("path-to-bash/bash.exe C:/Users/myDir/Desktop/ss1.sh").start(); or new ProcessBuilder("path-to-bash/bash.exe -c C:/Users/myDir/Desktop/ss1.sh").start(); –MrTux Aug 26 '14 at 18:35 thanks that got rid of the error,,,but nothing is happening. If I run through cygwin directly the script runs –Doc Holiday Aug 26 '14 at 19:38 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged java shell or ask your own question. asked 2 years ago viewed 8256 times active 2 years ago Linked 1 Issue in Compiling SOA 12C project with Maven Related 0Exception in thread “main” java.io.IOException: Cannot run program “D:/cygwin/bi n/bash”: CreateProcess error=193, %1 is not a valid Win32 application1Error: Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified. Applies for all executables0Cannot run
error=193, %1 is not a valid https://netbeans.org/bugzilla/show_bug.cgi?id=158761 Win32 application Summary: java.io.IOException: CreateProcess error=193, %1 is not a valid Win32 applica... Status: RESOLVED FIXED Product: php Classification: Unclassified Component: PHPUnit Version: 6.x Hardware: All https://issues.jenkins-ci.org/browse/JENKINS-21953 All Priority: P3 (vote) TargetMilestone: 6.x Assigned To: Tomas Mysik QA Contact: issues@php URL: http://statistics.netbeans.org/except... Whiteboard: EXCEPTIONS_REPORT Keywords: Depends on: Blocks: Show dependency tree createprocess error /graph Reported: 2009-02-18 17:00 UTC by Exceptions Reporter Modified: 2009-05-14 08:40 UTC (History) CC List: 7 users (show) abajja fortruth kldamr kolen phejl purnama tprochazka See Also: Issue Type: DEFECT Exception Report : Attachments stacktrace (1.22 KB, text/plain) 2009-02-18 17:00 UTC, Exceptions Reporter Details stacktrace (1.27 KB, text/plain) createprocess error 193 2009-02-19 10:34 UTC, tprochazka Details stacktrace (1.21 KB, text/plain) 2009-04-02 15:44 UTC, abajja Details stacktrace (1.20 KB, text/plain) 2009-04-17 10:38 UTC, abajja Details View All Add an attachment (proposed patch, testcase, etc.) Note You need to log in before you can comment on or make changes to this bug. Description Exceptions Reporter 2009-02-18 17:00:16 UTC Build: NetBeans IDE Dev (Build 2009-02-18_12-46-28) VM: Java HotSpot(TM) Client VM, 11.0-b16, Java(TM) SE Runtime Environment, 1.6.0_11-b03 OS: Windows XP, 5.1, x86 User Comments: GUEST: I was setting phpunit script in netbeans because it was not found. I use xampplite in windows buzzword: Opened Tools->Options for PHP configuration options. GUEST: I was setting phpunit script in netbeans because it was not found. I use xampplite in windows Stacktrace: java.io.IOException: Cannot run program ""D:\Program Files\xampplite\php\phpunit"": CreateProcess error=193, %1 is not a valid Win32 application at java.lang.ProcessBuilder.start(ProcessBuilder.java:459) at org.netbeans.api.extexecution.ExternalProcessBuilder.call(ExternalProcessBuilder.java:288) at org.netbeans.api.extexecution.ExternalProcessBuilder.call(ExternalProcessBuilder.java:70) at org.netbeans.api.extexecution.ExecutionService$3.call(ExecutionService.java:254) at org.netbeans.api.extexecution.ExecutionService$3.call(ExecutionService.java:230) at java.util.concurrent.FutureTask$Sync.in
- 15th for workshops, presentations and all things Jenkins Learn more Export Tools JenkinsJENKINS-21953NodeJs plugin doesn't work on windows based Jenkins machineLog In ExportXMLWordPrintable Details Type: Bug Status: Open Priority: Major Resolution: Unresolved Component/s: nodejs-plugin Labels: None Environment: Windows 2012, Jenkins 1.552, and NodeJS Plugin 0.2.1 Similar Issues: Show Description Using the instructions provided, I setup the plugin locally and point it to my existing installation of NodeJs (since it is a windows machine). I then setup my job to use an execute script to get my node version, which works. When I add a execute nodejs script to my build with this in it: var sys = require('sys'); sys.puts('build number:' + process.env['BUILD_NUMBER']); sys.puts('current directory: ' + process.cwd()); I get this error when I run the job: Building in workspace C:\Program Files (x86)\Jenkins\jobs\NodeJs\workspace [workspace] $ sh -xe C:\Windows\TEMP\hudson3559847244933178029.sh + node --version v0.10.26 [workspace] $ C:\Windows\TEMP\hudson6840666181877118834.js %1 is not a valid Win32 application FATAL: command execution failed java.io.IOException: Cannot run program "C:\Windows\TEMP\hudson6840666181877118834.js" (in directory "C:\Program Files (x86)\Jenkins\jobs\NodeJs\workspace"): CreateProcess error=193, %1 is not a valid Win32 application at java.lang.ProcessBuilder.start(Unknown Source) at hudson.Proc$LocalProc.