classpath

Robert Field robert.field at oracle.com
Wed Feb 15 01:00:01 UTC 2017


~/ works everywhere a filename can appear.

So, you can now do

jshell> /env --class-path ~/JavaLibs/guava-21.0.jar 

Robert (under a volcano)





On February 14, 2017 9:55:22 AM Michel Trudeau <michel.trudeau at oracle.com> 
wrote:

> I would go for such an improvement.   Please file an RFE.
> --
> Michel
>
>
>
>> Peter Levart <mailto:peter.levart at gmail.com>
>> February 12, 2017 at 1:09 PM
>>
>>
>>
>>
>> No, perhaps not. But it would perhaps be nice to have some kind of
>> platform-independet way to expand either current Java system
>> properties or process environment variables (or both) in arguments of
>> jshell's slash-commands. So one could do for example:
>>
>> jshell> /env --class-path {user.home}/JavaLibs/guava-21.0.jar
>> |  Setting new options and restoring state.
>>
>> jshell> /env
>> |     --class-path /home/peter/JavaLibs/guava-21.0.jar
>>
>>
>>
>> Regards, Peter
>>
>> Peter Levart <mailto:peter.levart at gmail.com>
>> February 12, 2017 at 12:57 PM
>> Hi,
>>
>>
>>
>> The problem seems to be the tilde "~" character you used to specify
>> the path to the jar file. For example:
>>
>> jshell> /env --class-path ~/JavaLibs/guava-21.0.jar
>> |  Setting new options and restoring state.
>>
>> jshell> /env
>> |     --class-path ~/JavaLibs/guava-21.0.jar
>>
>> jshell> import com.google.common.base.Function;
>> |  Error:
>> |  package com.google.common.base does not exist
>> |  import com.google.common.base.Function;
>> |         ^-----------------------------^
>>
>>
>> ...but...
>>
>> jshell> /env --class-path /home/peter/JavaLibs/guava-21.0.jar
>> |  Setting new options and restoring state.
>>
>> jshell> /env
>> |     --class-path /home/peter/JavaLibs/guava-21.0.jar
>>
>> jshell> import com.google.common.base.Function;
>>
>> jshell>
>>
>>
>> The "tilde" character is usually expanded by a UNIX shell:
>>
>>  bash$ echo ~
>> /home/peter
>>
>> ...but jshell seems to interpret it literally.
>>
>> Should jshell treat and expand /env arguments according to the rules
>> of native shells on the corresponding platforms? For example, should
>> it expand %VARIABLE% on Windows and ${VARIABLE} or $VARIABLE on UNIX-es ?
>>
>> Regards, Peter
>>
>> Michael Müller <mailto:michael.mueller at mueller-bruehl.de>
>> February 12, 2017 at 7:03 AM
>> Hi,
>>
>>
>> formerly I could use
>>
>> /classpath
>> ~/Dropbox/Vortrag/ParallelStreams/ParallelStreams/target/ParallelStreams.jar
>>
>> |  Path '~/Dropbox/Vortrag/ParallelStreams/ParallelStreams/target/
>>        ParallelStreams.jar' added to classpath
>> jshell> import de.muellerbruehl.parallelstreams.PersonManager
>>
>>
>> SInce this has become /env, I have trouble with it:
>>
>> jshell> /env -class-path
>> ~/Dropbox/Vortrag/ParallelStreams/ParallelStreams/target/ParallelStreams.jar
>>
>> |  Setting new options and restoring state.
>>
>> jshell> /env
>> |     --class-path
>> ~/Dropbox/Vortrag/ParallelStreams/ParallelStreams/target/ParallelStreams.jar
>>
>>
>> jshell> import de.muellerbruehl.parallelstreams.PersonManager
>> |  Error:
>> |  package de.muellerbruehl.parallelstreams does not exist
>> |  import de.muellerbruehl.parallelstreams.PersonManager;
>> |         ^--------------------------------------------^
>>
>> Although /env displays the added classpath, it is not recognized.
>> To add a classpath, I have to leave the shell and restart it with the
>> classpath option.
>> And btw. the doc states a directory will be accepted as classpath. But
>> I always have to add the fully qualified name of the jar. The
>> directory only does not work :(
>>
>


More information about the kulla-dev mailing list