Java On-Line Compiler

A

ak

The on-line compiler is an excellent way to
check that code is 'self-contained', as well
as being small - the page will only accept
source files up to 10Kb.

Comments welcome.

works fine, except saving class file:

Not Found
The requested URL
/home/physci2/public_html/public_compile/aa8QmelfSqJe/Test.class was not
found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an
ErrorDocument to handle the request.


Apache/1.3.29 Server at www.physci.org Port 80

____________

http://reader.imagero.com the best java image reader.
 
A

ak

The on-line compiler is an excellent way to
check that code is 'self-contained', as well
as being small - the page will only accept
source files up to 10Kb.

Comments welcome.

What I miss is possibility to start generated class file.
Job for your Launcher.

____________

http://reader.imagero.com the best java image reader.
 
A

Andrew Thompson

.....
| The requested URL
|
/home/physci2/public_html/public_compile/aa8QmelfSqJe/Test.class
was not

That's odd, it's definitely there (I checked).
I will be looking into gathering all classes
into a .jar file for the user (in the event that
one source has a number of classes)

I'll look into that at the same time and see
if I can figure the problem.
 
A

Andrew Thompson

| >
| > The on-line compiler is an excellent way to
....
| Not Found
| The requested URL
|
/home/physci2/public_html/public_compile/aa8QmelfSqJe/Test.class
was not
| found on this server.

D'Oh! What a dang fool. Now I have spotted
my error (public_compile is at the root of my site)
should have it fixed soon..
 
A

Andrew Thompson

| | ....
| | The requested URL
| |
|
/home/physci2/public_html/public_compile/aa8QmelfSqJe/Test.class
| was not
|
| That's odd, it's definitely there (I checked).
| I will be looking into gathering all classes
| into a .jar file for the user (in the event that
| one source has a number of classes)

I think I have fixed the link problem, at
the same time I took the opportunity to
'zip up' the class(es) and source into a
..jar file, I'll have to do further checking
before I can confirm I did it right..

[ And just to confirm - it will not work with
packages, and does not (yet) create a manifest.. ]
 
A

Andrew Thompson

| > The on-line compiler is an excellent way to
| > check that code is 'self-contained', as well
| > as being small - the page will only accept
| > source files up to 10Kb.
.....
| What I miss is possibility to start generated class file.
| Job for your Launcher.

I was looking into this, but unfortunately
there are dangers to allowing code to be
run straight off the server, even if it is
contained within the applet security
sandbox at the user end.

After all, it's easy to make an irritatingly
recursive Applet that works completely
within the confines of the sandbox.

I shudder to imagine what malevolent
people could come up with if they set
their nasty little minds to it.. :-(
 
A

Alex Hunsley

Andrew said:
In addition to the recently posted article on the
'Short, Self-contained, Compileable Example', at..
http://www.physci.org/codes/sscce.jsp
I have added an on-line compiler,
(linked from the page) at..
http://www.physci.org/javac.jsp

The on-line compiler is an excellent way to
check that code is 'self-contained', as well
as being small - the page will only accept
source files up to 10Kb.

Comments welcome.

Thanks Andrew, that's very useful for testing code snippets people post!
Saves opening a new window, cutting and pasting the text to a new file
etc...

alex
 
A

Alex Hunsley

Andrew said:
| > The on-line compiler is an excellent way to
| > check that code is 'self-contained', as well
| > as being small - the page will only accept
| > source files up to 10Kb.
....
| What I miss is possibility to start generated class file.
| Job for your Launcher.

I was looking into this, but unfortunately
there are dangers to allowing code to be
run straight off the server, even if it is
contained within the applet security
sandbox at the user end.

After all, it's easy to make an irritatingly
recursive Applet that works completely
within the confines of the sandbox.

I shudder to imagine what malevolent
people could come up with if they set
their nasty little minds to it.. :-(

Just what I was thinking - you *don't* want to be running any pasted in
code on your server :)
You can bet your bottom dollar someone would abuse it.

alex
 
A

Andrew Thompson

....
| I have added an on-line compiler, at..
| http://www.physci.org/javac.jsp

Now updated, I implemented a suggestion
by Jim Sculley to allow the example PhySci
codes to be imported, by offering a link to
the plain source from each page that displays
'formatted' source (for both the displayer and
launcher pages) .

Then I went the whole hog and added a
drop-down list of the available source on
the 'javac' page itself. The list excludes
any source that is over the 10Kb limit I have
set (so the ATM and Calculator are not listed).

What else.. Oh yeah. I have switched on
'save ouput' by default, since it only seems
to _fail_ on my local machine, the web
server handles it fine..

Still working on the manifest file to allow
'double click launch' of the generated jar
files..
 
A

Andrew Thompson

<from your other post>
" ..that's very useful for testing code snippets people post!"

I had to smile when I read how you worded that,
as it is exactly to encourage people _not_ to post
'snippets'. The compiler will reject snippets as
surely as javac from the command line.. ;-)

....
| Just what I was thinking - you *don't* want to be running any
pasted in
| code on your server :)
| You can bet your bottom dollar someone would abuse it.

I think I may have been mistaken there...
Given the code is actually running in the
user's own JVM in their browser, it puts no
special demands on my server.

The _only_ malevolent thing I _think_
they could do is create an Applet
(assuming I offer to show them applets
in a page) that opens a new window
with the same page, before refreshing
itself [ I would call this applet
'BreedLikeRabbits' ;-) ]

That _might_ cause trouble on whatever
machine they run it, and cause a load on
the server (until the applet is cached?)

....hmmm. I'll think about it further.
(See also the other interesting development)
 
A

ak

| What I miss is possibility to start generated class file.
| Job for your Launcher.

I was looking into this, but unfortunately
there are dangers to allowing code to be
run straight off the server, even if it is
contained within the applet security
sandbox at the user end.

After all, it's easy to make an irritatingly
recursive Applet that works completely
within the confines of the sandbox.

I shudder to imagine what malevolent
people could come up with if they set
their nasty little minds to it.. :-(

self-evident I didn't mean to run it on the server.
I mean that you could generate page with applet.
And user can decide if he want to run this applet.


____________

http://reader.imagero.com the best java image reader.
 
A

Andrew Thompson

....
| Still working on the manifest file to allow
| 'double click launch' of the generated jar
| files..

Now done. Since I could not work head
nor tail of Sun's 'Manifest' class, I sloppily
just wrote the appropriate bytes to the
JarOutputStream.

Interestingly, you can click the link to the
..jar file and if you choose 'open' rather
than 'save to disk', it should actually
launch straight from the link (I had
_completely_ forgotten you can launch
jar's from a link!)

Of course, I would _prefer_ people to
save it to disk first, that way they save
bandwidth for themselves and me..
 
A

Alex Hunsley

Andrew said:
<from your other post>
" ..that's very useful for testing code snippets people post!"

I had to smile when I read how you worded that,
as it is exactly to encourage people _not_ to post
'snippets'. The compiler will reject snippets as
surely as javac from the command line.. ;-)

Oops, I didn't really mean snippets in that way, I meant self-contained
runnable and all the rest of it! :)
...
| Just what I was thinking - you *don't* want to be running any
pasted in
| code on your server :)
| You can bet your bottom dollar someone would abuse it.

I think I may have been mistaken there...
Given the code is actually running in the
user's own JVM in their browser, it puts no
special demands on my server.

The _only_ malevolent thing I _think_
they could do is create an Applet
(assuming I offer to show them applets
in a page) that opens a new window
with the same page, before refreshing
itself [ I would call this applet
'BreedLikeRabbits' ;-) ]

That _might_ cause trouble on whatever
machine they run it, and cause a load on
the server (until the applet is cached?)

...hmmm. I'll think about it further.
(See also the other interesting development)

Be interested to hear if you find out more about the possibility of this
and associated problems...
Someone could deliberately overload your CPU as a sort of DOS attack
which wouldn't be very desirable! Hmmm, any ways around that...

alex
 
A

Andrew Thompson

| > | What I miss is possibility to start generated class file.
| > | Job for your Launcher.
....
| self-evident I didn't mean to run it on the server.
| I mean that you could generate page with applet.
| And user can decide if he want to run this applet.

I am still trying to sort out the details of it
in my own head ak [ it was not self-evident
to me at the time ;-) ]

Interestingly, I've made some other posts,
wherein basically I am coming to the conclusion
that maybe it is _only_ applets that will be
a problem. Ironic really.

Check for my post that mentions the
BreedLikeRabbitsApplet...

Still mulling it all over, but the apps are
definitely launchable now, straight from the
link. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top