Win a copy of Create an Uber Clone in 7 Days: Build a real world full stack mobile app in Java this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Linux system calls  RSS feed

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

Does anybody know how to make Linux system calls from a Java call? I need to rename files and I can not use the Java file .rename. The only way I can do it is to use the System mv command.

Thanks,

AMD
 
author and iconoclast
Sheriff
Posts: 24220
40
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A "system call" (like calling link() from C) or "running a program" (like typing "mv" at the shell)?

If it's the former, Java has a mechanism called "JNI" by which you can call platform-native code from Java code. But I think you're talking about the latter, in which case you just want to use the java.lang.Runtime.exec() family of methods.
 
Andrew Mcmurray
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Yes, I was talking about the later I will look into the runtime mehtods.

AMD
 
What's brown and sticky? ... a stick. Or a tiny ad.
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!