Bug 268424 - /cp support in JShell
/cp support in JShell
Status: RESOLVED FIXED
Product: java
Classification: Unclassified
Component: JShell
Dev
PC Windows 7
: P2 with 1 vote (vote)
: Dev
Assigned To: Svata Dedic
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-10-09 09:34 UTC by Geertjan Wielenga
Modified: 2016-12-19 21:24 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Geertjan Wielenga 2016-10-09 09:34:31 UTC
Adding jars with "/cp Foobar.jar" does not seem to put the JAR on the classpath of the project-specific JShell. That needs to be supported.
Comment 1 michael.simons 2016-10-09 09:38:29 UTC
FYI: On a Mac with OS X 10.11, NetBeans 8.2, this doesn't work as well.
Comment 2 Geertjan Wielenga 2016-10-09 09:40:51 UTC
It's simply not supported yet in the NetBeans JShell integration, I believe. Early days and it's amazing all the features that are there already, really cool integration and I'm going to be using this more and more, especially when the issues we've filed so far are fixed.
Comment 3 Svata Dedic 2016-11-22 08:59:37 UTC
what should be the effect ? It *could* be possible to adjust CP of the jshell, but should not affect the project's settings. 
OK ?
Comment 4 michael.simons 2016-11-22 10:02:56 UTC
Hello everybody,

the desired effect is as follow:

I want to use "/cp Foobar.jar" so that I can import those classes and use them like I would do with build-ins.

The classpath of the project need not to be modified.

At the moment I observe the following behavior: I can import classes from the projects Maven dependencies without error, but the moment I try to use them, I end up with a class not found exception.
Comment 5 Svata Dedic 2016-11-25 16:20:46 UTC
Partial support provided in jet-main#36707b9bc76c; still need to implement pathname completion.
Comment 6 Quality Engineering 2016-11-27 02:51:33 UTC
Integrated into 'main-silver', will be available in build *201611270001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/36707b9bc76c
User: Svata Dedic <sdedic@netbeans.org>
Log: #268424: initial /classpath support in JShell
Comment 7 Svata Dedic 2016-12-01 13:49:52 UTC
Completion enhanced in jet-main#d965ddd6800a

Relative paths to project contents are also supported.
Comment 8 michael.simons 2016-12-02 20:46:35 UTC
Hi,
i tried this on a mac with 201611300001, but the JShell is barely usable when opened from a Maven project anymore:


|  Unexpected exception reading start-up: java.lang.NullPointerException

|  Welcome to the JShell NetBeans integration
|  Type /help for help

[1] -> 1+1
|  The remote Java Shell has terminated. Restart the Java Shell to continue
|  Expression value is: null
|    assigned to temporary variable $1 of type int

[2] -> 

The download for the later builds (from 20161201 upwards) is broken, I tried http://bits.netbeans.org/dev/nightly/2016-12-01_00-01-33/ in 3 browsers, no download buttons.

Will the patch make it into http://deadlock.netbeans.org/job/prototypes-repl9/? I used that repo to get JShell into my stable build.
Comment 9 Svata Dedic 2016-12-02 21:35:26 UTC
what JDK does the mvn project target ?

The prototype branch is more or less dead; if extremely needed, some changes can be backported, but javac binaries started to diverge between trunk and repl-prototype.

I'll focus on maven support next week (I was primarily working with J2SE projects).
Comment 10 michael.simons 2016-12-03 07:17:53 UTC
I tried with JDK 1.8 and 1.7.  

Prototype branch: I think you already do have enough work todo. Not extremely needed. 

Thanks for working on this. 
Michael
Comment 11 Svata Dedic 2016-12-03 09:53:36 UTC
Please be aware that support for JDK 7 may be dropped (depends on time). The code in JShell, which is largely used in the "vm agent" uses heavily lambdas. I'm not sure if I am able to cut/replace all the dependencies in the new code drop so the classes are still usable on 1.7.
As JDK 1.7 is EOLed, it's not a superhigh priority, although there are lot of JEE deployments on that platform.
Comment 12 michael.simons 2016-12-03 11:59:25 UTC
I don't need JDK 7, just tried both to give feedback. 

I don't expect it to be supported.
Comment 13 michael.simons 2016-12-19 21:24:02 UTC
Using the latest build from December I was able to create this http://info.michael-simons.eu/2016/12/19/using-jshell-in-netbeans/

Really useful, thanks!


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo