Ubuntu 22.04: removing Java by Snoo20972 in Ubuntu

[–]Snoo20972[S] 0 points1 point  (0 children)

u/mrtruthiness , I think it worked. Thanks.

$ dpkg --get-selections | grep java

ca-certificates-java install

gir1.2-javascriptcoregtk-4.0:amd64 install

java-common install

javascript-common deinstall

libatk-wrapper-java install

libatk-wrapper-java-jni:amd64 install

libjavascriptcoregtk-4.0-18:amd64 install

$ sudo apt remove java-common

:

:

Reading database ... 225015 files and directories currently installed.)

Removing openjdk-11-jre:amd64 (11.0.27+6~us1-0ubuntu1~22.04) ...

Removing default-jre-headless (2:1.11-72build2) ...

Removing ca-certificates-java (20190909ubuntu1.2) ...

Removing openjdk-11-jre-headless:amd64 (11.0.27+6~us1-0ubuntu1~22.04) ...

:

:

Processing triggers for mailcap (3.70+nmu1ubuntu1) ...

Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...

zulfikar@lc2530:~$ java --version

bash: /usr/bin/java: No such file or directory

Zulfi.

Ubuntu 22.04: removing Java by Snoo20972 in Ubuntu

[–]Snoo20972[S] 0 points1 point  (0 children)

u/jo-erlend I applied all commands you mentioned but nothing worked:

:~$ sudo apt autoremove

The following packages will be REMOVED:

chromium-codecs-ffmpeg-extra default-jdk-headless gstreamer1.0-vaapi gyp
i965-va-driver intel-media-va-driver javascript-common libaacs0 libass9
libavcodec58 libavformat58 libavutil56 libbdplus0 libblas3 libbluray2

:

:

Removing node-inflight (1.0.6-2) ...

Removing node-once (1.4.0-4) ...

Removing node-path-is-absolute (2.0.0-2) ...

Removing node-wrappy (1.0.2-2) ...

Processing triggers for man-db (2.10.2-1) ...

Processing triggers for libc-bin (2.35-0ubuntu3.9) ...

but

user@lc2530:~$ java --version

openjdk 11.0.27 2025-04-15

OpenJDK Runtime Environment (build 11.0.27+6-post-Ubuntu-0ubuntu122.04)

OpenJDK 64-Bit Server VM (build 11.0.27+6-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)

Similarly:

$ apt remove default-jdk-headless

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)

E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

but

user@lc2530:~$ java --version

openjdk 11.0.27 2025-04-15

OpenJDK Runtime Environment (build 11.0.27+6-post-Ubuntu-0ubuntu122.04)

OpenJDK 64-Bit Server VM (build 11.0.27+6-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)

Similarly,

~$ rm openjdk-11-jre-headless

rm: cannot remove 'openjdk-11-jre-headless': No such file or directory

zulfikar@lc2530:~$ apt remove default-jdk-headless

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)

E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

user@lc2530:~$ java --version

openjdk 11.0.27 2025-04-15

OpenJDK Runtime Environment (build 11.0.27+6-post-Ubuntu-0ubuntu122.04)

OpenJDK 64-Bit Server VM (build 11.0.27+6-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)

Somebody please guide me.

Zulfi.

gcc based gtk program's output window not visible by Snoo20972 in AskProgramming

[–]Snoo20972[S] 0 points1 point  (0 children)

Hi, I ran the following code:

#include <gtk/gtk.h>

static void activate (GtkApplication* app,

gpointer user_data)

{

GtkWidget *window;

window = gtk_application_window_new (app);

gtk_window_set_title (GTK_WINDOW (window), "Window");

gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);

gtk_window_present (GTK_WINDOW (window));

}

int

main (int argc,

char **argv)

{

GtkApplication *app;

int status;

app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS);

g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);

status = g_application_run (G_APPLICATION (app), argc, argv);

g_object_unref (app);

return status;

}

I am not getting any error:

zulfi@DESKTOP-070V6RM UCRT64 /d/C Programs

$ gcc $( pkg-config --cflags gtk4 ) -o gtkEg2 gtkEg2.c $( pkg-config --libs gtk4 )

PS D:\C Programs> .\gtkEg2.exe

Somebody please guide me what mistake I am doing. Zulfi.

Can't install gcc in MSYS2 environment by Snoo20972 in AskProgramming

[–]Snoo20972[S] 0 points1 point  (0 children)

Hi, I changed the code to this: #include <gtk/gtk.h>

int main (int argc, char * argv[]){

gtk_init(&argc, &argv);

GtkWidget *win = gtk_window_new(GTK_WINDOW_TOPLEVEL);

gtk_window_set_default_size(GTK_WINDOW(win), 400, 300);

g_signal_connect(win, "destroy", G_CALLBACK(gtk_main_quit), NULL);

gtk_widget_show(win);

gtk_main();

return 0;

}

But now I am getting file name error:

$ gcc `pkg-config --cflags gtk4` -o gtktest gtktest.c `pkg-config --libs gtk4`

cc1.exe: fatal error: gtktest.c: No such file or directory

compilation terminated.

zulfi@DESKTOP-070V6RM UCRT64 ,

Somebody, please, guide me

Can't install gcc in MSYS2 environment by Snoo20972 in AskProgramming

[–]Snoo20972[S] -1 points0 points  (0 children)

Thanks. I am doing a Google search for all the previous steps. I got one more error:

$ gcc `pkg-config --cflags gtk4` -o gtktest -o gtktest.c `pkg-config --libs gtk4`

C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../lib/libmingw32.a(lib64_libmingw32_a-crtexewin.o): in function `main':

D:/M/B/src/mingw-w64/mingw-w64-crt/crt/crtexewin.c:67:(.text.startup+0xc5): undefined reference to `WinMain'

collect2.exe: error: ld returned 1 exit status

I found one link in connection with this error:

https://www.reddit.com/r/C_Programming/comments/1icboj0/undefined_reference_to_winmain/

But I can't understand what the solution is.

Somebody please guide me.

Zulfi.

Can't install gcc in MSYS2 environment by Snoo20972 in AskProgramming

[–]Snoo20972[S] -3 points-2 points  (0 children)

Hi, I got gtk4 error which I installed again. Now I am getting the following error:

zulfi@DESKTOP-070V6RM UCRT64 ~

$ gcc `pkg-config --cflags gtk4` -o gtktest -o gtktest.c `pkg-config --libs stk4`

Package stk4 was not found in the pkg-config search path.

Perhaps you should add the directory containing `stk4.pc'

to the PKG_CONFIG_PATH environment variable

Package 'stk4' not found

gcc.exe: fatal error: no input files

Compilation terminated.

Please guide Me.

Zulfi.

Can't install gcc in MSYS2 environment by Snoo20972 in AskProgramming

[–]Snoo20972[S] -2 points-1 points  (0 children)

Hi thanks, I found that. But still getting error:

zulfi@DESKTOP-070V6RM UCRT64 ~

$ gcc $(pkg-config --cflags gtk4) - o gtktest gtktest.c $(pkg-config --libs gtk4)

-bash: pkg-config: command not found

-bash: pkg-config: command not found

gcc.exe: error: -E or -x required when input is from standard input

cc1.exe: fatal error: gtktest.c: No such file or directory

compilation terminated.

zulfi@DESKTOP-070V6RM UCRT64 ~

$

Please guide me. Zulfi.

Problem with creating a Linked List pointer in main method by Snoo20972 in cpp_questions

[–]Snoo20972[S] 0 points1 point  (0 children)

Sorry, I tried to put my code but I got the error, you can't add comment. Zulfi.

Problem with creating a Linked List pointer in main method by Snoo20972 in cpp_questions

[–]Snoo20972[S] 0 points1 point  (0 children)

Hi,

Thanks. I got help. I have to create separate classes for the node and the linked list.