Casper Maxwell

Ranch Hand
+ Follow
since Aug 04, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Casper Maxwell

Probably you meant "blank .txt file manually" instead of "black .txt file"

You can create new files as follows:

File file = new File(fileName);
file.createNewFile();

So if the filename "blank.txt" then the code snippet above creates an empty file named "blank.txt" in the current folder. (normally application folder)

And if you want to make sure that its directories exist before saving the file:

File dir = new File(dirName);
dir.mkdirs();
15 years ago

The former is efficient and fast, but quite difficult to program. The latter is inefficient and slow, but much easier to program.



Yes. You are right. I just noticed your answer..
[ July 27, 2006: Message edited by: Casper Maxwell ]
15 years ago
I dont know your exact aim so i wanted to show one more approach if your problem does not require a shell script strictly.

You can invoke Java programs from C programs using JNI as described below:

http://java.sun.com/docs/books/jni/html/invoke.html
15 years ago
If you want to use Java libraries from C side then you can use JNI. The following chapter of the JNI book describes this usage:

http://java.sun.com/docs/books/jni/html/invoke.html
15 years ago
You can also search for similar scripting languages to Perl available for Java. For example, the article below says Sleep and Perl is similar:

http://today.java.net/pub/a/today/2005/07/14/sleep.html
15 years ago
For reading/writing files, the following tips may help:

Reading Text from a File
http://www.java-tips.org/java-se-tips/java.io/reading-text-from-a-file.html

Writing to a File
http://www.java-tips.org/java-se-tips/java.io/writing-to-a-file.html
[ July 21, 2006: Message edited by: Casper Maxwell ]
15 years ago
For a list of HTML parsers, you can try the following link:

http://www.java-tips.org/java-libraries/html-parser/

And if you want to see some examples of usage of regex package, you can visit the following url:

http://www.java-tips.org/java-se-tips/java.util.regex/

One related example available there is:

How to find and display hyperlinks contained within a web page
http://www.java-tips.org/java-se-tips/java.util.regex/how-to-find-and-display-hyperlinks-contained-within-a-web-page.html
15 years ago
And if you want to check whether other alternatives support this or not, here is a list of similar libraries:

http://www.java-tips.org/java-libraries/pdf-library/
15 years ago
These tips may help:

How to find contacts from PhoneBook of mobile phone
http://www.java-tips.org/content/view/1379/73/

How to import Contact into phonebook
http://www.java-tips.org/content/view/1380/73/
16 years ago