changing priorities

Oh, amd amusing enough, ur example of using cd doesn't work. I wish it did, that would be cool, but alas it gives me an error and then the program continues on its merry way (I added a loop to my main file so it keeps asking me to make more unix commands). Oh well. Of minor note, as is, ur code doesn't give an obvious way to make ls commands look "nice;" aka with spacing or returns of anykind. I'm sure I could figure it out if it wasn't two in the moring and I had a paper to do, but allas it is 2 in the morning and I have a paper to do.

F-bacher
 
Originally posted by IamBob
for what you're doing...how 'bout:

[ cutted out the code ]

maybe? I'm sure you'll figure it out eventually.

Great man. i'll give that a try. Thanks for helping. I tried something similar, but ran into some errors with the Buffered'. You use it a bit different. Maybe this will work.

It's great to have people like you on the forum.
keep on rockin'
DJ

[Edited by The DJ on 11-17-2000 at 06:31 AM]
 
Looks like output goes out of scope because u created it inside try... but then u call it outside of try. Bad java code, Bad.

I'm not sure I understand what you mean and for which set of code you're talking about.

While it is true that I don't stick to Java guidelines my code usually works. I'm bad at throwing exceptions. If there's nothing you can do to recover from the exception I return null or false(if return type is boolean)...sorry about that. you can easily take out the try { } catch() {} code and put in the proper throws clause. And yes, I know it looks really bad when I mix The Real Way(tm) with My Way(tm)...again, sorry.


If you're just trying to do a change directory(using the first code I posted):

System.out.print(ShellAccess.doCommand("cd library/dekstop/"));
System.out.print(ShellAccess.doCommand("ls"));

you can format the String returned and display it however you want. I would probably use java.util.StringTokenizer for that.

I tried something similar, but ran into some errors with the Buffered'. You use it a bit different. Maybe this will work.

I'm not too good with Java IO so I hope it works. :) I may end up using it later if it does work.

bob
 
I think it is working.

Not really sure yet. Because of the way i use it, i had to make some adjustments, but i will get there.

When it is ready, i'll tell you and i will post it at my site.

DJ
 
I'm using the commandline for JAVA and TextEdit for writing the source. Works fine for me.
Haven't had the chance to look at the Dev Tools yet, but i will use them for this later.

Still running into problems though. I don't know how smbclient uses the incoming stream. But it is not what i would expect it to be. Might be the buffers to, i simply do not know. This is probably going to take a long time. I'll put the source of what i have got so far on my site.
Don't know if you have smbclient, but you might want to take a look at it anyway.

This is what is so strange. If you start up the client to connect to a server you get back a few status lines (two) and then the password prompt. First lines return fine. Then everything seems to just lock up.

DJ
http://home.student.utwente.nl/d.hartman/watdoeik/gui.html

 
Okay, I don't exactly agree with your style but I must say your code is nice. Comments aplenty and formatted well.. very readable.

public class ShellAccess {
Process p;

ShellAccess() {}
public IOClass startProcess(String command) {
try {
Runtime r = Runtime.getRuntime();
p = r.exec(command);

should be:
public class ShellAccess {
Process copy; //for a handle.

ShellAccess() {}

public IOClass startProcess(String command) {
try {
Runtime r = Runtime.getRuntime();
Process p = r.exec(command);
makeUseableHandle(p);
//rest of method as follows..
}

public void makeUseableHandle(Process p) { copy = p; }
//other methods..
}


It seems as though this is the only way it works. Sorry if my mistake held you up...hope that helps.

[fixed code]
 
Originally posted by IamBob
Okay, I don't exactly agree with your style but I must say your code is nice. Comments aplenty and formatted well.. very readable.

It seems as though this is the only way it works. Sorry if my mistake held you up...hope that helps.

I don't agree with the style either. But this was the fastest way to write it at the moment. And the code is all messed up because of trial and error coding.
When i have something working i'm going to start all over again using Projectbuilder. ;-)

I'll try this out tomorrow, after i have finished my paper.
And i have all the time to write this. It is just a nice side-project not my life. ;-)

tnx for all the help, DJ
 
Okay, I just realized..I did the same exact thing as you're doing now.

I started with TextEdit and the command line and my code was kind of messed up because I was trial&error coding...but it worked. Then, I got the dev tools and rewrote the entire thing from almost-scratch and am still at it.

anyway, your code is alot cleaner looking than I could ever hope to write.

good luck on the paper! see ya.
 
Still not working. But i have a new idea now. I think smbclient creates it's own runtime. I'm going to try that out tomorrow.

The source you gave me is working. But the prompt from smbclient is still at my console. I found out that if the password has to be returned and i type it at the console and press enter, it is accepted. That's why i made the assumption on the different runtime.

I'll see.
 
I'm having serious problems with Swing.

I'm attempting to make my program look as "Aquafied" as possible and am suffering for it. I haven't found a good way to give it the stripped look. I've got all these repaint problems and I'm ready to write Apple to tell them where to stick the MacLookAndFeel. Sometimes(when it's doing a whacked out repaint) it looks as though those stripes are somewhere underneath the rest of the UI elements..I dunno.

ahhhh!!!

Well, I hope your project goes better than mine...good luck.
 
If your using the dev tools you can use interface builder to give it the look and feel. Its supposed to be compatible with Java but I haven't tried it and can't say for sure.

Hope this helps :),
 
Thanks but I've tried it.

It uses Apple's NSxxx classes. The documentation on those classes leaves plenty to be desired. Apple made it harder to use by making them(NSxxx) 'start' at java.lang.Object and by giving you no way to mix with awt or swing. In short: not very easy to get into if you've only ever used Java.

However, I've licked my reapint problem. The drawback: speed(shouldn't be too bad) and ease of programming.

a couple more things to add and it's good to go.
 
Well i dropped the whole shell like setup i had before. I simply couldn't get it to work and didn't feel like wasting anymore time on it.

Luckily there is another way. You can have all the functionality within one command. Only problem with it is that you have to setup a new connetion every time you do an action. This is generally considered to be not real nice towards the system administrator, because i leaves so many log messages.

So now if i want to show the contends of a directory i simply exec the command
Code:
smbclient \\Server\Share -N -D subdir/subsub -c 'ls'

So i finally have something working. If you want to see it, go to http://home.student.utwente.nl/d.hartman/watdoeik/gui.html .
It isn't ready for a release yet, but i'm still working on it. Just look at the ToDo list.

I tried building the example Java-cocoa application, but got all kinds of framework not found errors. I will try again later. I realy want to cocoa'fy this. It would really increase speed prob.

thx for all the help man. This is going to be a great product when it is finished. Good bye Thursby Inc. with their expensive DAVE client and welcome to the open source community.

DJ
 
your page keeps crashing iCab! I disabled Javascript and everything. not even http://www.crashme.com (<-- Caution!) killed iCab...maybe it's just some stupid iCab bug.

I'll go download OmniWeb so I can check it out. :)
 
Originally posted by IamBob
your page keeps crashing iCab! I disabled Javascript and everything. not even http://www.crashme.com (<-- Caution!) killed iCab...maybe it's just some stupid iCab bug.

Strange all i use are tables and lists, nothing extrodinary. Tried it in my version of iCab and showed up fine.

DJ
 
yeah? oh well, I got OmniWeb and took a look.

Nicer is here! (finally!) :D

It should work if you use Classic Expander but will not if you use OSX's. I'll tar.gz it and put that up instead when I get a chance. (what were the commands again?)

If you like what you see(GUI wise at least) I can put up a Project Builder example for you to play with.

see ya.
 
Originally posted by IamBob

(what were the commands again?)

If you like what you see(GUI wise at least) I can put up a Project Builder example for you to play with.

To create
gnutar -czvf nameofpackage.tar.gz directory(you_want_to_compress)

It is best to change the user of all the files to root and even the permissions to world. It will prevent any probs.

to uncompress
gnutar -xzvf fileyouwanttodecompress

And maybe i'll take you up on that offer.

DJ
 
I changed the permissions, tar.gzed it and it's up. (thanks!)

I'll see if I can't get the Project Builder example up later.
 
I'm very interested in how you parsed the output of command to a list. And even more how you made it clickable. I want to do that to show files in my interface.
 
Back
Top