SpencerPark / IJava

A Jupyter kernel for executing Java code.
MIT License
1.1k stars 215 forks source link

jupyter notebook webbased: NO java syntax highligting #101

Open sant527 opened 4 years ago

sant527 commented 4 years ago

I have installed this its very very useful

I want to know how to see syntax highlighting of my code.

I ran the command in my terminal

jupyter notebook

Then jupyter notebook opens and then i select Java shell

I see the java code without syntax highlighting. How to get the syntax highlighting

image

utenma commented 4 years ago

close and reopen the notebook, it worked for me

kyagrd commented 4 years ago

This happens because the notebook metadata is not populated with enough information when it is created.

    "language_info": {
        "name": ""
    }

When you change the above to below, syntax highlighting starts to work.

    "language_info": {
        "name": "java"
    }

This seem to be a pretty common problem in Jupyter. I've searched for it and Julia community has (or had) the same problem and there was a fix like that. See https://github.com/jupyterlab/jupyterlab/issues/6826#issue-467830861

A good fix should make sure that every notebook is created with proper metadata, but meanwhile you can quickly fix manually for each notebook you are using.

In case of Jupyter Lab there you can do this in the left sidebar. Go to the tools icon on the very right, expand the "Advanced Tools", and there you can edit the metadata.

sant527 commented 4 years ago

Thank you, When i close and reopen the notebook, it worked for me it woked.

Also i will try @kyagrd solution